I am not quite sure if this is the right state exchange site or not. Pls let me know.

So, I noticed that Logic and Pro Tools, etc. have this waveform shrinking and expanding effect when dragging the region through tempo changes.

Here's a short video: https://imgur.com/a/ol8JB6J

I was wondering how one would achieve that? Given that you have a point cloud representing your peaks and a window size in which the waveform should be rendered, how could one shrink and expand the waveform in real time? Because the window size obviously changes depending on the tempi given during the window. I guess you'd have to know the viewport pixelToSampleRateFrame ratio for every vertical pixel line, but still. It seems super expensive to redraw it with every movement the user does. I can't really wrap my head around how that would work in a efficient way and I thought that maybe someone here has an idea.

  • $\begingroup$ it looks to me like a moving magnifying glass that works only on the $x$-axis (or "$t$-axis"), not on the $y$-axis. it would be a resampling issue, but the audio is sampled at a far higher rate than is evident in these waveform drawings. so it's about picking out the right sample for drawing the pixel. $\endgroup$ – robert bristow-johnson Sep 22 at 15:21
  • $\begingroup$ So what you mean is instead of going through sample by sample, one should go pixel by pixel and pick the corresponding sample (or bucket of samples) to draw? $\endgroup$ – Johannes Klauß Sep 23 at 7:09
  • $\begingroup$ But doesn't that bucket size change with the different magnifying multipliers in real time? Or do you just split that specific bucket into multiple buckets depending on the magnifying multiplier? $\endgroup$ – Johannes Klauß Sep 23 at 9:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.