Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Excellent with MP3s but problematic with WAVE files #128

Open
Gigamick opened this issue Oct 20, 2020 · 8 comments
Open

Excellent with MP3s but problematic with WAVE files #128

Gigamick opened this issue Oct 20, 2020 · 8 comments

Comments

@Gigamick
Copy link

When I use this on my application for MP3's it's all amazing. However I have some users uploading .WAV files and their waveform renders look like this:

Screenshot 2020-10-20 at 12 27 17

Which is very wrong. Any ideas?

@chrisn
Copy link
Member

chrisn commented Oct 20, 2020

I'd be happy to investigate. Can you share an example WAV file with me? My contact email is in the commit history.

@Gigamick
Copy link
Author

Thanks!! (ps I also emailed you....)

@aerogus
Copy link

aerogus commented Aug 26, 2022

I also have this "bug" with 60min length .wav file (pcm / 16 bits / stereo / 48kHz). All is saturated in the json export (all values are -127,+128 in 8 bits, or -32767,+32768 in 16 bits).
The "bug" can be resolved by increasing the number of measurements (= decreasing --zoom param or decreasing --pixels-per-second param). But this increase a lot the weight of the json file.

Capture d’écran 2022-08-26 à 16 27 47

@chrisn
Copy link
Member

chrisn commented Aug 26, 2022

Can you provide an example audio file for me to look at?

@aerogus
Copy link

aerogus commented Aug 26, 2022

here is the WAV file (680Mb) :
https://wetransfer.com/downloads/610d0c275f83bd1f3e2a179e798e7cc620220826153809/c0ed2c8d4f2dc0db25bd6a2441af8fb020220826153828/998fa7

command executed :

% audiowaveform -i audiowaveform-test.WAV -o audiowaveform-test.json --zoom 172800 --bits 8 --split-channels
Input file: audiowaveform-test.WAV
Frames: 172800000
Sample rate: 48000 Hz
Channels: 2
Format: 0x10002
Sections: 1
Seekable: yes
Generating waveform data...
Samples per pixel: 172800
Input channels: 2
Output channels: 2
Done: 100%
Read 172800000 frames
Generated 1000 points
Output file: audiowaveform-test.json
Done

and excerpt of the json generated file :

{"version":2,"channels":2,"sample_rate":48000,"samples_per_pixel":172800,"bits":8,"length":1000,"data":[-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-127,124,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,-128,127,...]}

I set the zoom value at 172800 thinking there will be 1000 measurements (48000 * 3600 / 1000) ...

 % audiowaveform --version
AudioWaveform v1.6.0

OS MacOS 12.5.1 (Monterey). audiowaveform installed with homebrew

@chrisn
Copy link
Member

chrisn commented Aug 26, 2022

Thanks, I've downloaded the file, I'll take a look.

@chrisn
Copy link
Member

chrisn commented Aug 26, 2022

It's the same if I view in Audacity, the waveform is saturated. You see more detail with a lower zoom level, but if you need a fixed 1000 pixel width image, with this audio it'll just look like a solid block. So audiowaveform is working as designed. I wonder what ffmpeg is doing?

@Gigamick Did we figure out what was happening in your case? I don't remember the details, I apologise if I didn't reply...

@aerogus
Copy link

aerogus commented Aug 26, 2022

Thanks for your reply. The command i use with ffmpeg is the following :

ffmpeg -y -i audiowaveform-test.WAV \
-f lavfi -i color=s=960x540:c=0x292933 \
-filter_complex \
 "[0:a]showwavespic=s=960x540:colors=0xffffff:split_channels=1[waveform]; \
 [1:v][waveform]overlay=0:0" \
-frames:v 1 \
-hide_banner -loglevel warning \
audiowaveform-test.png

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants