bbc / peaks.js

JavaScript UI component for interacting with audio waveforms
https://waveform.prototyping.bbc.co.uk
GNU Lesser General Public License v3.0
3.2k stars 279 forks source link

same width for all mp3 json output #429

Open nemesisKO opened 2 years ago

nemesisKO commented 2 years ago

hi how can i generate wave in exact width or array length in json for all mp3s. for example i want same array length for 2 minute mp3 as 5 minute mp3

chrisn commented 2 years ago

You can use the waveform-data.js resample() function with the width option to give you JSON with a given array length. The algorithm it currently uses means it won't be exactly the right length, but I have a fix for that coming soon.