Re: [Audacity-devel] Patch to fix freeze when using Shift+Play on a track that's not 44100Hz
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Maarten B. <maa...@ho...> - 2012-12-10 00:51:39
|
On 10/12/12 00:55, Gale Andrews wrote: > Sorry, I'm not seeing this (libsamplerate or libresample). Do you have > steps to reproduce it? Maybe my description wasn't clear. This is not an issue with the resampling code, it's just the way the range is changed combined with the way the values of the points on the time track are stored. Try this: - Create a sine wave. - Create a time track, make some changes so you can clearly hear the pitch change. - Change the range of the time track to something much larger, e.g. 50%-500%. Notice how the values are not centered around 100% now (well you can't see this because there's no vertical ruler, my patch adds that too). - Play the sine wave. The pitch is now much higher and the change in pitch is too. This is wrong, it should sound exactly the same, so you don't have to redo any work that you did previously. Anyway, this is what I've changed so far (see attachment): - draw vruler for time tracks - use double instead of long for the time track range (90% = 0.9, 110% = 1.1) because this simplifies the code that has to do the resampling and also improves accuracy (now I just need to find an alternative to wxGetNumberFromUser that allows doubles so you can actually use this ...) - copy time track range (and mHeight) on Init() rather than setting it to a fixed value - rescale time track values (envelope) when the range changes - save/load time track range The patch also includes my previous patch to VarRateResample so you can test it with repeat on without freezes. I wasn't sure about some things, I've labeled those 'TODO-MB'. In particular: - TimeTrack::GetRangeLower(): What's a sensible minimum value? Also, TrackPanel already forces a much higher minimum value (13%), so what's the point of adding another one here? - TimeTrack::HandleXMLTag(): A lot of the old settings don't seem to make any sense. A time track doesn't have a channel or an offset, right? Can I remove these? I've commented them out for now. - TrackPanel::OnSetTimeTrackRange(): The range is limited to 13%-1200%, what's the meaning of these values? I know libsamplerate can do much more (0.39%-25600%), is something else limiting this? Would it make sense to use different limits for different resamplers? This could be a problem because the range is stored in the project file now ... I've also attached two project files that show the improvements. The second one in particular is interesting because it often reproduces the bug where sound at the end is cut off early. I haven't looked into that one yet. Maarten Baert |