Re: [Audacity-devel] Analysing ultrasound recordings with Audacity
A free multi-track audio editor and recorder
Brought to you by:
aosiniao
From: Thor A. <ta...@to...> - 2011-05-04 14:53:45
|
On Sun, May 01, 2011 at 11:54:26PM +0100, Martyn Shaw wrote: > On 30/04/2011 00:49, Martyn Shaw wrote: > > On 27/04/2011 17:35, Thor Andreassen wrote: [...] > > > o The 'Maximum frequency' in 'Preferences->Spectrograms' shouldn't > > > be capped at 100 KHz, attached patch sets it at 10 MHz. Maybe the > > > cap should be removed? > > > > Your patch works fine for me with your file. I'd have to look harder > > into whether we should have some cap on it. > > There has to be some cap, due to the size of integers (see below). Ok. > It needs to be set with reference to the max size of the fft window as > well, Maybe I'm being dense, but could you explain how these are related? > and possibly something else we have not thought of, so we should be > careful. Yes. > > > o Add more FFT window sizes. [...] > > > My patch causes a segfault when zooming out on the frequency axis > > > of the spectrogram, this is also the case when enabling > > > EXPERIMENTAL_FIND_NOTES. Not sure how to fix. [...] > We have an overflow in the arithmetic in lines 1809 & 1810 with these > bigger windowSize and minFreq/maxFreq values, which are both int. > Multiplying them together can cause an overflow with the larger > values, say windowSize = 32768 and min/maxFreq > 131072Hz. Locally I > have fixed this with: > TrackArtist.cpp lines 1809-1810 > int minSamples = int ((double)minFreq * (double)windowSize / rate > + 0.5); // units are fft bins > int maxSamples = int ((double)maxFreq * (double)windowSize / rate > + 0.5); > > Does that work for you? That's the problem, your solution fixes it. > Is it the best way of doing it? One cast should suffice, and float should be accurate enough: int maxSamples = int ((float) maxFreq * windowSize / rate + 0.5); > I think the the result will not exceed an int since maxFreq/rate is > probably 1/2 at most. I agree. [...] > We are in a state of 'feature freeze' at the moment, trying to get to > that elusive 'Stable Release', and so one big patch is unlikely to get > accepted into Audacity at the moment. Why don't you break this down > into different elements that could be applied in series, each one > checked for problems as we go along. Start with the renaming patch. Ok. [...] -- best regards Thor Andreassen |