Re: [Audacity-devel] Question about spectral analysis in Audacity
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: <ga...@au...> - 2009-06-29 21:43:19
|
Martyn Shaw wrote: > > Julien > > I have implemented a 'convolve' effect in Audacity here (but I never > put all the 'bells and whistles' in to finish it off). However it is > usable for basic benchmarking the speed of an fft. I used fftw3. > > Convolving 2 60s samples takes about 9-10s here. This involves taking > an FFT of 60*2*44100 samples, doing the complex multiplications, > taking the inverse transform and then normalising. That's equivalent > to FFTing a 2 minute, 44100Hz sampled signal in less than 3s. > > http://www.fftw.org/ is open source and not too difficult to get going > with Audacity (I managed it!). If you want to use 'long' FFT lengths > then I think it's the way to go. Just a POV. I noticed we now analyze up to the first 237.8 seconds of audio in 1.3.8 (must have missed that someplace). On my XP box (2.6 GHz 1 GB RAM) if I select that much or longer it takes 10 -18 seconds before anything happens. If the audio is over 237.8, the "anything" is the length warning, after which the Spectrum displays at once. Should this be progress dialogued? And maybe the selected length calculated and the warning thrown before starting the calculation? Gale > Michael Chinen wrote: > Are you trying to take THE spectrum of a 60 second segment (with one > FFT,) or are you interested in finding the average spectrum by taking > many small FFTs over the duration and averaging it out? These may > yield similar results but the process is very different. > > You probably know this, but I just want to point out that in O(n log > n), n is in samples, not seconds, so each second adds a big factor to > the running time of the algorithm. I would be willing to bet you > aren't going to be able to finish a FFT of size 44100*60 for a very > long time. > > The Plot Spectrum command appears to take many small ones and average > them, since you can select the FFT size in the popup window, with a > maximum of 16384. If that's the case I'm not sure why it has a 24 > second limit either. > > > Michael > > > > On Fri, Jul 18, 2008 at 2:24 PM, Julien F. Vanegue <jf...@ce...> wrote: >>> Computing the spectrum requires all samples to be in memory at once >>> and costs n*log(n), so operating on many seconds of sound is unusual. >>> If the spectrum is very stable, e.g. a steady tone, then you probably >>> don't need to look at many seconds to extract the spectral >>> information. If the spectrum is changing, then grabbing the spectrum >>> of a large interval is in some sense going to smear out or average the >>> overall energy, so again, it's not so useful. Finally, there are >>> numerical issues to worry about when doing a very large Fourier >>> transform to compute the spectrum. What might be useful is to compute >>> a sequence of short-term spectra and average their magnitudes to get a >>> long-term average spectrum. Audacity could do this in principle, but >>> the user would have to provide more parameters and confirm that he/she >>> really wants to do an expensive computation on a long segment of audio. >> Alright. So if I understand well, there is no hidden reason to forbid >> spectral analysis on >> a larger sample. O(n log n) is a very reasonable complexity for a >> fourier transform and >> I am ready to wait some more seconds to compute the spectrum for 60 >> seconds instead >> of 24 seconds. I will modify the audacity source code for my own needs >> in that direction. >> >> Thanks for your quick answer >> >> Julien |