I’m working on an application that displays an audio file as a waveform using the AudioThumbnail class. To implement zooming we resize the component that draws the thumbnail using setSize(). This works fine until you try to zoom in too far at which point the waveform begins to look choppy and discontinuous. See the images below. I’m wondering if the AudioThumbnail class is not the right choice for this, or if there is a better way. Does anyone have any tips for allowing zooming down to the sample level?
If you want a more precise representation (sample level etc) of the wav then just resizing the Component wont do the trick. I tried getting away with this before with no luck…
You need to come up with a mechanism that redraws the wav with new startTimeSeconds, and endTimeSeconds when you zoom. Increasing the startTimeSeconds and decreasing endTimeSeconds is the zoom.
The thumbnail code isn’t really geared up for that level of detail, but could be tweaked - it currently just draws vertical lines for each position, but I guess if it detected vertical gaps between neighbouring lines, it could fill them in, and that’d look a lot better.
Thank you both for the responses. I tried aiit’s suggestion of changing the start and end time rather than resizing the component. I still ran into the same problem in some cases. I think, as jules mentioned, I’m bumping into the limits of the AudioThumbnail class.
Thanks again for taking the time to respond.