bbc / audiowaveform

C++ program to generate waveform data and render waveform images from audio files
https://waveform.prototyping.bbc.co.uk
GNU General Public License v3.0
1.94k stars 242 forks source link

The generated data doesn't seem to be in the correct format for use with peaks.js #80

Closed semiaddict closed 6 years ago

semiaddict commented 6 years ago

First off, thank you for those great tools.

I have successfully used peaks.js with an AudioContext to generate the peaks dynamically. I have also successfully installed audiowaveform (v1.2.2) on a Debian 9.

However, when I use audiowaveform to pre-generate the data, the output in peaks.js does not seem right. I have tested with different files, including _TOL_6min_720pdownload.mp3 found in peaks.js's _testdata folder.

Attached are the data for _TOL_6min_720pdownload.mp3 generated with the following command: audiowaveform -i TOL_6min_720p_download.mp3 -o TOL_6min_720p_download.json as well as screenshots illustrating the output difference between data from an AudioContext and data from audiowaveform.

JSON data: TOL_6min_720p_download.zip

Peaks.js with an AudioContext (correct):

image

Peaks.js with the generated dat file (incorrect):

image

I am guessing this is an issue with audiowaveform and not peaks.js. Any idea where things might be going wrong? The data files provided in peaks.js's _testdata folder seem to be correctly generated. Do you know which version of audiowaveform was used to generate those files?

Edit: If I use audiowaveform to generate a png, the output is correct. audiowaveform -i TOL_6min_720p_download.mp3 -o TOL_6min_720p_download.png --pixels-per-second 5.0 -w 1000 -h 200 gives the following result: tol_6min_720p_download

semiaddict commented 6 years ago

I should have read peaks.js docs more thoroughly... It needs the data in 8-bit resolution, with the -b 8 option. That seems to do it.