Re: [Audacity-devel] Zooming in to Spectrum view - committed
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: <Mar...@ao...> - 2007-01-24 01:16:42
|
Hiya Ok, so at my second attempt (only my second attempt! I must be getting better!) I managed to make this work. The news is good and bad (but mostly good here, at least). I tested with a 10s piece of audio, with Audacity full-screen at a 1024x768 resolution. The results are unsurprising since I have swapped the screen resolution for the FFT size in the cache: Switching from a waveform view to a spectrum with an fft size of 4096 is about 10% slower (not good, more samples to calculate and cache in Spectrum::ComputeSpectrum). Switching from a waveform view to a spectrum with an fft size of 256 (the default) is about 10% faster (good, less things to calculate in Spectrum). Resizing the spectrum window when it's 'large' is about 4-10 times faster, when it's 'small' is about 18-20 times faster (no calculations in Spectrum, only a bit more in TrackArtist). Vertical zooming is 4-14 times faster, depending on window size, and now quite usable (I didn't think it really was before). Horizontal scrolling is 1-1.1 times slower (not good, but not too bad either). Overall I thought this was OK so I checked it in. Hope you agree. Any further ideas? TTFN Martyn In a message dated 21/01/2007 09:58:38 GMT Standard Time, do...@au... writes: Martyn, I'd have to think about the exact details, but I totally agree with the general idea that the spectral values should be cached, rather than the resized spectrogram image. That should also make vertical sizing of a spectrogram much faster, too. - Dominic On Jan 20, 2007, at 2:44 PM, Mar...@ao... wrote: > Hi > > I implemented the zooming in to the spectrum view but it is very > slow and does not take advantage of the clever caching arrangement > in WaveClip::GetSpectrogram. I have come up with a plan to > increase the speed and wondered if anybody has an opinion on it > before I set to work. I would: > > 1 Redefine viewHeight in SpecCache to be windowSize/2 and cache the > spectral values, rather than the displayed values. This means I > will always get a hit on the cache when zooming in and out > vertically, and not redo all the ffts. > 2 Remove all reference to max and min frequencies in the spectral > calculations. > 3 Move the summing-for-display section of ComputeSpectrum (lines > 154-189) into TrackArtist::DrawClipSpectrum about line 1435. This > would involve the max and min displayed frequencies. It would get > used for horizontal scrolling however (it isn't currently) as the > displayed greyscale values would not be cached, so would presumably > slow this down. > > Is this a good idea? > > Martyn |