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

minimum width for a visualized overview? #519

Open EZWrighter opened 9 months ago

EZWrighter commented 9 months ago

When my data length is under 3.5 seconds the visualization behaves incorrectly. Showing the 3.5 second timeline as a minimum but only showing the waveform as a portion of that. Not displaying it as an overview at 100% of the canvas.

image

chrisn commented 9 months ago

This is because the waveform data doesn't have enough pixels to fit the canvas width. The easiest solution is to create the waveform with a lower number of samples per pixel. Or we could change Peaks.js to stretch the waveform.

rafeautie commented 6 months ago

Or we could change Peaks.js to stretch the waveform.

This seems like a more robust way of handling it, although, would that make the visual wonky?

chrisn commented 1 month ago

It would have a lower resolution, I guess the more stretching is applied the worse it will look. It's worth trying.