New FFT function

36 messages Options
Embed this post
Permalink
1 2
Philip Van Baren

New FFT function

Reply Threaded More More options
Print post
Permalink
I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated the
NoiseRemoval and Equalizer effects to use the new functions.  By my
benchmarks this gives a better than 2x speedup in NoiseRemoval, and similar
improvement in the processing part of Equalizer.

I also made a crude remap from FFT() to the new function as proof of
concept, and found we can also get some significant improvement in the Plot
Spectrum function.  It should also help in the spectrogram plots, but I
wasn't sure how to benchmark that.  I didn't submit the crude remap, though,
but have attached it to this email in case anyone is interested.

Phil


------------------------------------------------------------------------------
Are you an open source citizen? Join us for the Open Source Bridge conference!
Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
Need another reason to go? 24-hour hacker lounge. Register today!
http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel

FFT.diff (4K) Download Attachment
Leland (Audacity Team)

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Philip Van Baren wrote:

> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
> the NoiseRemoval and Equalizer effects to use the new functions.  By my
> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
> similar improvement in the processing part of Equalizer.
>
> I also made a crude remap from FFT() to the new function as proof of
> concept, and found we can also get some significant improvement in the
> Plot Spectrum function.  It should also help in the spectrogram plots,
> but I wasn't sure how to benchmark that.  I didn't submit the crude
> remap, though, but have attached it to this email in case anyone is
> interested.
>
Phil,

Can you check something with your new implementation.

1)  Start Audacity clean
2)  Generate -> Chirp with default parameters (sine, freq: 440-1320, amp: 0.8-0.8, linear, 30 secs)
3)  Effect -> Equalization (draw curves, length: 4001, curve: amradio)

If you have View -> Show Clipping turned on, you should see a fair amount of regularly spaced clipping with missing sections of audio.

Leland


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Leland,

The problem turns out to be the original FFT() function has the sign
inverted on imaginary values relative to the standard definition of the DFT.
The net result of this is the time shifts go in the wrong direction. You can
get away with this as long as you make the same error in both the forward
and inverse transform and/or if you only deal with data symmetric about 0.
In this case I didn't change the FFT function references used to create the
filter, but I did change the FFT functions used when applying the filter.
Since the original function and my function are using opposite imaginary
signs, and the equalizer filter is not symmetric about 0, this causes the
problem you noted.

The simple fix would be to change FFT.c to use the correct sign:

-if (InverseTransform)
+if (!InverseTransform)
      angle_numerator = -angle_numerator;

The downside with this solution is if any asymmetrical FFT values were
stored in an older version of Audacity using the incorrect sign, and then
get recalled and used in a current version of Audacity using the correct
sign, you'll get an incorrect result.  I looked over the code, and I don't
see anywhere where the real and imaginary part are stored between sessions.
For the most part in Audacity only the magnitude is used, so I think the
Equalizer effect is the only code that would be sensitive to the sign of the
imaginary part.

If there are no objections, I'll make the above patch to FFT.c

If there are objections, the harder fix would be to change the sign of my
function to use the same sign as the original FFT function.

Phil


Note: If you want to verify for yourself that the sign is incorrect, compute
the FFT of a shifted impulse (a vector of zeros, with only vector[1] = 1).
>From the definition of the FFT the result should be F[n] =
1*exp(-2*pi*i*1*n/N)  The imaginary part of this starts at 0 and goes
negative (due to the -2pi).  If you make this calculation using the original
FFT function in Audacity the imaginary part starts at 0 and goes positive.

---- sample test code ----------
   float *impulse = new float[mWindowSize];
   float *outr = new float[mWindowSize];
   float *outi = new float[mWindowSize];

   for(i=0; i<mWindowSize; i++)
      impulse[i] = 0;
   impulse[1] = 1;
   FFT(mWindowSize,false,impulse,0,outr,outi);

   fp=fopen("impulse.txt","w");
   for(i=0; i<mWindowSize; i++) {
      fprintf(fp, "%g\t%g\n", outr[i], outi[i]);
   }
   fclose(fp);
   delete[] impulse;
   delete[] outr;
   delete[] outi;
---------------------

--------------------------------------------------
From: "Leland" <[hidden email]>
Sent: Tuesday, June 23, 2009 7:56 PM
To: <[hidden email]>
Subject: Re: [Audacity-devel] New FFT function

> Philip Van Baren wrote:
>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
>> the NoiseRemoval and Equalizer effects to use the new functions.  By my
>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>> similar improvement in the processing part of Equalizer.
>>
>> I also made a crude remap from FFT() to the new function as proof of
>> concept, and found we can also get some significant improvement in the
>> Plot Spectrum function.  It should also help in the spectrogram plots,
>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>> remap, though, but have attached it to this email in case anyone is
>> interested.
>>
> Phil,
>
> Can you check something with your new implementation.
>
> 1)  Start Audacity clean
> 2)  Generate -> Chirp with default parameters (sine, freq: 440-1320, amp:
> 0.8-0.8, linear, 30 secs)
> 3)  Effect -> Equalization (draw curves, length: 4001, curve: amradio)
>
> If you have View -> Show Clipping turned on, you should see a fair amount
> of regularly spaced clipping with missing sections of audio.
>
> Leland
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel 


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
In reply to this post by Leland (Audacity Team)


Leland wrote:

> Philip Van Baren wrote:
>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
>> the NoiseRemoval and Equalizer effects to use the new functions.  By my
>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>> similar improvement in the processing part of Equalizer.
>>
>> I also made a crude remap from FFT() to the new function as proof of
>> concept, and found we can also get some significant improvement in the
>> Plot Spectrum function.  It should also help in the spectrogram plots,
>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>> remap, though, but have attached it to this email in case anyone is
>> interested.
>>
> Phil,
>
> Can you check something with your new implementation.
>
> 1)  Start Audacity clean
> 2)  Generate -> Chirp with default parameters (sine, freq: 440-1320, amp: 0.8-0.8, linear, 30 secs)
> 3)  Effect -> Equalization (draw curves, length: 4001, curve: amradio)
>
> If you have View -> Show Clipping turned on, you should see a fair amount of regularly spaced clipping with missing sections of audio.

Phil

This looks very much like a problem with 'overlap - add' in
EffectEqualization::ProcessOne that has been caused by the new FFT
code.  It is clearly an unacceptable error and needs fixing /
reverting to the old code.  Any idea about what went wrong?

In the future, please communicate on audacity-devel when you are
planning to make major changes like this.

TTFN
Martyn

> Leland
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
In reply to this post by Philip Van Baren
Phil

I think you should definitely hold off on any more commits until we
have the bugs removed from the current ones, and some confidence that
your FFT is better / at least as good as the current one.  I'm sure
that a 'Real' FFT is faster than what we have but it's got to work
properly first.

Please explain your 'crude remap' once that is done.

Thanks for your input!
Martyn

Philip Van Baren wrote:

> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
> the NoiseRemoval and Equalizer effects to use the new functions.  By my
> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
> similar improvement in the processing part of Equalizer.
>
> I also made a crude remap from FFT() to the new function as proof of
> concept, and found we can also get some significant improvement in the
> Plot Spectrum function.  It should also help in the spectrogram plots,
> but I wasn't sure how to benchmark that.  I didn't submit the crude
> remap, though, but have attached it to this email in case anyone is
> interested.
>
> Phil
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel

------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Leland (Audacity Team)

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
In reply to this post by Philip Van Baren
Saw your fix.  Amazing how one little thing like that can cause so much grief eh?

Anyway, I'll leave the final say to the others in the group that understand this sort of thing, but I gotta tell ya, if you RealFFTf produces acceptable quality, this is gonna be a great addition to Audacity.  The speed is just awesome!

Leland


Philip Van Baren wrote:

> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
> the NoiseRemoval and Equalizer effects to use the new functions.  By my
> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
> similar improvement in the processing part of Equalizer.
>
> I also made a crude remap from FFT() to the new function as proof of
> concept, and found we can also get some significant improvement in the
> Plot Spectrum function.  It should also help in the spectrogram plots,
> but I wasn't sure how to benchmark that.  I didn't submit the crude
> remap, though, but have attached it to this email in case anyone is
> interested.
>
> Phil
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
In reply to this post by Martyn Shaw-2
Martyn,

Sorry about the confusion.  It is now fixed.  I tracked down the bug last
night and sent an email about the fix to the list, but for some reason it
doesn't look like it got relayed on.

The 'crude remap' that I attached to my email a couple days ago checks if
the incoming data is real (imaginary pointer is NULL) and if so it calls my
routine instead of continuing on with the existing complex->complex FFT
function.  Upon return it remaps the output of my function to the expected
output of the FFT function.  I don't see anywhere in Audacity where it
actually uses complex->complex (although sometimes both vectors are supplied
and it just ignores the imaginary part) so all FFT calls could get remapped
to the new code this way with some performance benefit.

The new functions are optimized for doing the same FFT many times in a row,
and they process the incoming buffer in-place.  The remap does help, but to
get the full benefits would require modifying the way the FFT function is
called, similar to what I did in NoiseRemoval and Equalization.

Phil

--------------------------------------------------
From: "Martyn Shaw" <[hidden email]>
Sent: Wednesday, June 24, 2009 7:21 PM
To: <[hidden email]>
Subject: Re: [Audacity-devel] New FFT function

> Phil
>
> I think you should definitely hold off on any more commits until we
> have the bugs removed from the current ones, and some confidence that
> your FFT is better / at least as good as the current one.  I'm sure
> that a 'Real' FFT is faster than what we have but it's got to work
> properly first.
>
> Please explain your 'crude remap' once that is done.
>
> Thanks for your input!
> Martyn
>
> Philip Van Baren wrote:
>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
>> the NoiseRemoval and Equalizer effects to use the new functions.  By my
>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>> similar improvement in the processing part of Equalizer.
>>
>> I also made a crude remap from FFT() to the new function as proof of
>> concept, and found we can also get some significant improvement in the
>> Plot Spectrum function.  It should also help in the spectrogram plots,
>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>> remap, though, but have attached it to this email in case anyone is
>> interested.
>>
>> Phil
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Are you an open source citizen? Join us for the Open Source Bridge
>> conference!
>> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
>> $250.
>> Need another reason to go? 24-hour hacker lounge. Register today!
>> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel 


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
In reply to this post by Philip Van Baren
Phil

Thanks for reverting the EQ to a working state.

Spectrum view is also broken and has a strong alias component shown
which does not exist.  Proof:
Project rate at 44100
Generate -> Chirp Sine, start freq 1, stop 20000, amplitude 0.8,
linear, 10s.
Listen to it, clearly a sweep.
Spectrum view
See the big X?  The bottom left to top right is correct, the top left
to bottom right isn't.  You would be able to hear it, particularly
after about 6s.

Any ideas?
Martyn

Philip Van Baren wrote:

> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
> the NoiseRemoval and Equalizer effects to use the new functions.  By my
> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
> similar improvement in the processing part of Equalizer.
>
> I also made a crude remap from FFT() to the new function as proof of
> concept, and found we can also get some significant improvement in the
> Plot Spectrum function.  It should also help in the spectrogram plots,
> but I wasn't sure how to benchmark that.  I didn't submit the crude
> remap, though, but have attached it to this email in case anyone is
> interested.
>
> Phil
>
>
> ------------------------------------------------------------------------
>
> ------------------------------------------------------------------------------
> Are you an open source citizen? Join us for the Open Source Bridge conference!
> Portland, OR, June 17-19. Two days of sessions, one day of unconference: $250.
> Need another reason to go? 24-hour hacker lounge. Register today!
> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel

------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Martyn,

I should have anticipated that.  I fixed the sign in the FFT function, but
he PowerSpectrum function calls FFT and is still expecting the inverted
imaginary values.  I'll fix it and submit a patch later tonight.

Phil

--------------------------------------------------
From: "Martyn Shaw" <[hidden email]>
Sent: Thursday, June 25, 2009 4:37 PM
To: <[hidden email]>
Subject: Re: [Audacity-devel] New FFT function

> Phil
>
> Thanks for reverting the EQ to a working state.
>
> Spectrum view is also broken and has a strong alias component shown
> which does not exist.  Proof:
> Project rate at 44100
> Generate -> Chirp Sine, start freq 1, stop 20000, amplitude 0.8,
> linear, 10s.
> Listen to it, clearly a sweep.
> Spectrum view
> See the big X?  The bottom left to top right is correct, the top left
> to bottom right isn't.  You would be able to hear it, particularly
> after about 6s.
>
> Any ideas?
> Martyn
>
> Philip Van Baren wrote:
>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
>> the NoiseRemoval and Equalizer effects to use the new functions.  By my
>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>> similar improvement in the processing part of Equalizer.
>>
>> I also made a crude remap from FFT() to the new function as proof of
>> concept, and found we can also get some significant improvement in the
>> Plot Spectrum function.  It should also help in the spectrogram plots,
>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>> remap, though, but have attached it to this email in case anyone is
>> interested.
>>
>> Phil
>>
>>
>> ------------------------------------------------------------------------
>>
>> ------------------------------------------------------------------------------
>> Are you an open source citizen? Join us for the Open Source Bridge
>> conference!
>> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
>> $250.
>> Need another reason to go? 24-hour hacker lounge. Register today!
>> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel 


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
The fix has been submitted.  Plot Spectrum and Spectrum view both work now.
I looked through all of the FFT, RealFFT and PowerSpectrum calls, and all
the references are ok now.  I can't find anything else which depends on
phase - but let me know if you find anything else.

Phil

--------------------------------------------------
From: "Philip Van Baren" <[hidden email]>
Sent: Thursday, June 25, 2009 7:19 PM
To: <[hidden email]>; <[hidden email]>
Subject: Re: [Audacity-devel] New FFT function

> Martyn,
>
> I should have anticipated that.  I fixed the sign in the FFT function, but
> he PowerSpectrum function calls FFT and is still expecting the inverted
> imaginary values.  I'll fix it and submit a patch later tonight.
>
> Phil
>
> --------------------------------------------------
> From: "Martyn Shaw" <[hidden email]>
> Sent: Thursday, June 25, 2009 4:37 PM
> To: <[hidden email]>
> Subject: Re: [Audacity-devel] New FFT function
>
>> Phil
>>
>> Thanks for reverting the EQ to a working state.
>>
>> Spectrum view is also broken and has a strong alias component shown
>> which does not exist.  Proof:
>> Project rate at 44100
>> Generate -> Chirp Sine, start freq 1, stop 20000, amplitude 0.8,
>> linear, 10s.
>> Listen to it, clearly a sweep.
>> Spectrum view
>> See the big X?  The bottom left to top right is correct, the top left
>> to bottom right isn't.  You would be able to hear it, particularly
>> after about 6s.
>>
>> Any ideas?
>> Martyn
>>
>> Philip Van Baren wrote:
>>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
>>> the NoiseRemoval and Equalizer effects to use the new functions.  By my
>>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>>> similar improvement in the processing part of Equalizer.
>>>
>>> I also made a crude remap from FFT() to the new function as proof of
>>> concept, and found we can also get some significant improvement in the
>>> Plot Spectrum function.  It should also help in the spectrogram plots,
>>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>>> remap, though, but have attached it to this email in case anyone is
>>> interested.
>>>
>>> Phil
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> ------------------------------------------------------------------------------
>>> Are you an open source citizen? Join us for the Open Source Bridge
>>> conference!
>>> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
>>> $250.
>>> Need another reason to go? 24-hour hacker lounge. Register today!
>>> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>>>
>>>
>>> ------------------------------------------------------------------------
>>>
>>> _______________________________________________
>>> audacity-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel 


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Thanks Phil, Spectrograms looks good to me now (not like I have
options to turn it on/off - in future use of Experimental.h would be a
good way to introduce code).

Are there any FFT bits left in Audacity that aren't using your code?
What would be you recommendations there (if there are any)?

TTFN
Martyn

Philip Van Baren wrote:

> The fix has been submitted.  Plot Spectrum and Spectrum view both work now.
> I looked through all of the FFT, RealFFT and PowerSpectrum calls, and all
> the references are ok now.  I can't find anything else which depends on
> phase - but let me know if you find anything else.
>
> Phil
>
> --------------------------------------------------
> From: "Philip Van Baren" <[hidden email]>
> Sent: Thursday, June 25, 2009 7:19 PM
> To: <[hidden email]>; <[hidden email]>
> Subject: Re: [Audacity-devel] New FFT function
>
>> Martyn,
>>
>> I should have anticipated that.  I fixed the sign in the FFT function, but
>> he PowerSpectrum function calls FFT and is still expecting the inverted
>> imaginary values.  I'll fix it and submit a patch later tonight.
>>
>> Phil
>>
>> --------------------------------------------------
>> From: "Martyn Shaw" <[hidden email]>
>> Sent: Thursday, June 25, 2009 4:37 PM
>> To: <[hidden email]>
>> Subject: Re: [Audacity-devel] New FFT function
>>
>>> Phil
>>>
>>> Thanks for reverting the EQ to a working state.
>>>
>>> Spectrum view is also broken and has a strong alias component shown
>>> which does not exist.  Proof:
>>> Project rate at 44100
>>> Generate -> Chirp Sine, start freq 1, stop 20000, amplitude 0.8,
>>> linear, 10s.
>>> Listen to it, clearly a sweep.
>>> Spectrum view
>>> See the big X?  The bottom left to top right is correct, the top left
>>> to bottom right isn't.  You would be able to hear it, particularly
>>> after about 6s.
>>>
>>> Any ideas?
>>> Martyn
>>>
>>> Philip Van Baren wrote:
>>>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and updated
>>>> the NoiseRemoval and Equalizer effects to use the new functions.  By my
>>>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>>>> similar improvement in the processing part of Equalizer.
>>>>
>>>> I also made a crude remap from FFT() to the new function as proof of
>>>> concept, and found we can also get some significant improvement in the
>>>> Plot Spectrum function.  It should also help in the spectrogram plots,
>>>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>>>> remap, though, but have attached it to this email in case anyone is
>>>> interested.
>>>>
>>>> Phil
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> ------------------------------------------------------------------------------
>>>> Are you an open source citizen? Join us for the Open Source Bridge
>>>> conference!
>>>> Portland, OR, June 17-19. Two days of sessions, one day of unconference:
>>>> $250.
>>>> Need another reason to go? 24-hour hacker lounge. Register today!
>>>> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>>>>
>>>>
>>>> ------------------------------------------------------------------------
>>>>
>>>> _______________________________________________
>>>> audacity-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> audacity-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel 
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Currently the only things using the new code are the convolution loops in
Equalization and NoiseRemoval.  Everything else is still using the old
function.

I'll clean up my remapping code and submit that (using an enable flag in
Experimental.h) which will allow for a conditional transition of everything
else.  My recommendation would be to leave the existing function for
complex-complex conversions (there aren't any, but it doesn't hurt to keep
the function for future use) and use the remap for RealFFT, InverseRealFFT,
and PowerSpectrum functions.

Phil

--------------------------------------------------
From: "Martyn Shaw" <[hidden email]>
Sent: Friday, June 26, 2009 7:53 PM
To: <[hidden email]>
Subject: Re: [Audacity-devel] New FFT function

> Thanks Phil, Spectrograms looks good to me now (not like I have
> options to turn it on/off - in future use of Experimental.h would be a
> good way to introduce code).
>
> Are there any FFT bits left in Audacity that aren't using your code?
> What would be you recommendations there (if there are any)?
>
> TTFN
> Martyn
>
> Philip Van Baren wrote:
>> The fix has been submitted.  Plot Spectrum and Spectrum view both work
>> now.
>> I looked through all of the FFT, RealFFT and PowerSpectrum calls, and all
>> the references are ok now.  I can't find anything else which depends on
>> phase - but let me know if you find anything else.
>>
>> Phil
>>
>> --------------------------------------------------
>> From: "Philip Van Baren" <[hidden email]>
>> Sent: Thursday, June 25, 2009 7:19 PM
>> To: <[hidden email]>; <[hidden email]>
>> Subject: Re: [Audacity-devel] New FFT function
>>
>>> Martyn,
>>>
>>> I should have anticipated that.  I fixed the sign in the FFT function,
>>> but
>>> he PowerSpectrum function calls FFT and is still expecting the inverted
>>> imaginary values.  I'll fix it and submit a patch later tonight.
>>>
>>> Phil
>>>
>>> --------------------------------------------------
>>> From: "Martyn Shaw" <[hidden email]>
>>> Sent: Thursday, June 25, 2009 4:37 PM
>>> To: <[hidden email]>
>>> Subject: Re: [Audacity-devel] New FFT function
>>>
>>>> Phil
>>>>
>>>> Thanks for reverting the EQ to a working state.
>>>>
>>>> Spectrum view is also broken and has a strong alias component shown
>>>> which does not exist.  Proof:
>>>> Project rate at 44100
>>>> Generate -> Chirp Sine, start freq 1, stop 20000, amplitude 0.8,
>>>> linear, 10s.
>>>> Listen to it, clearly a sweep.
>>>> Spectrum view
>>>> See the big X?  The bottom left to top right is correct, the top left
>>>> to bottom right isn't.  You would be able to hear it, particularly
>>>> after about 6s.
>>>>
>>>> Any ideas?
>>>> Martyn
>>>>
>>>> Philip Van Baren wrote:
>>>>> I submitted new FFT functions, RealFFTf and InverseRealFFTf, and
>>>>> updated
>>>>> the NoiseRemoval and Equalizer effects to use the new functions.  By
>>>>> my
>>>>> benchmarks this gives a better than 2x speedup in NoiseRemoval, and
>>>>> similar improvement in the processing part of Equalizer.
>>>>>
>>>>> I also made a crude remap from FFT() to the new function as proof of
>>>>> concept, and found we can also get some significant improvement in the
>>>>> Plot Spectrum function.  It should also help in the spectrogram plots,
>>>>> but I wasn't sure how to benchmark that.  I didn't submit the crude
>>>>> remap, though, but have attached it to this email in case anyone is
>>>>> interested.
>>>>>
>>>>> Phil
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Are you an open source citizen? Join us for the Open Source Bridge
>>>>> conference!
>>>>> Portland, OR, June 17-19. Two days of sessions, one day of
>>>>> unconference:
>>>>> $250.
>>>>> Need another reason to go? 24-hour hacker lounge. Register today!
>>>>> http://ad.doubleclick.net/clk;215844324;13503038;v?http://opensourcebridge.org
>>>>>
>>>>>
>>>>> ------------------------------------------------------------------------
>>>>>
>>>>> _______________________________________________
>>>>> audacity-devel mailing list
>>>>> [hidden email]
>>>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>>> ------------------------------------------------------------------------------
>>>> _______________________________________________
>>>> audacity-devel mailing list
>>>> [hidden email]
>>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>>
>>> ------------------------------------------------------------------------------
>>> _______________________________________________
>>> audacity-devel mailing list
>>> [hidden email]
>>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>
>>
>> ------------------------------------------------------------------------------
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel 


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Richard Ash

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
On Sat, 2009-06-27 at 09:01 -0400, Philip Van Baren wrote:

> Currently the only things using the new code are the convolution loops in
> Equalization and NoiseRemoval.  Everything else is still using the old
> function.
>
> I'll clean up my remapping code and submit that (using an enable flag in
> Experimental.h) which will allow for a conditional transition of everything
> else.  My recommendation would be to leave the existing function for
> complex-complex conversions (there aren't any, but it doesn't hurt to keep
> the function for future use) and use the remap for RealFFT, InverseRealFFT,
> and PowerSpectrum functions.

So am I right in thinking that we never need complex-complex transforms
on audio because the imaginary part of the time-domain data has no
physical meaning, and in practise is always zero? We obviously do need
complex data in the frequency domain (i.e. magnitude and phase of each
frequency) in order to preserve the phase relationship between different
frequencies, i.e. obtain the correct phase response for the various
filters.

The testing I've done with the latest CVS suggests that this is all in
order - I can create two tracks based on the same tones but with a phase
shift in one, filter them both and still see the different waveforms
afterwards.

If in the future we want to allow users to define the phase response of
filters in the equaliser (in order to replicate that of analogue filters
for example), then we will need to define and accept complex (i.e. real
and imaginary parts) curve definitions, so keeping the complex-complex
versions might well be useful.

Richard


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Richard,

Yes, you are right.  Since Audacity only deals with wave audio which doesn't
have an imaginary part, all of the existing FFT operations can be done using
real -> complex FFT, and complex -> real inverse FFT.  You can still add
phase response in the filters with these functions, because the frequency
data is still complex.  The restriction is only that the frequency data is
conjugate-symmetric (which makes the inverse FFT give a purely real output.)

Offhand I can't think of any use for having a complex time waveform, so
there shouldn't be any need for a complex -> complex conversion, but perhaps
there could be some effect added which operates on stereo data where one
channel is real and the other imaginary.

Phil

--------------------------------------------------
From: "Richard Ash" <[hidden email]>
Sent: Wednesday, July 01, 2009 3:52 PM
To: <[hidden email]>
Subject: Re: [Audacity-devel] New FFT function

> On Sat, 2009-06-27 at 09:01 -0400, Philip Van Baren wrote:
>> Currently the only things using the new code are the convolution loops in
>> Equalization and NoiseRemoval.  Everything else is still using the old
>> function.
>>
>> I'll clean up my remapping code and submit that (using an enable flag in
>> Experimental.h) which will allow for a conditional transition of
>> everything
>> else.  My recommendation would be to leave the existing function for
>> complex-complex conversions (there aren't any, but it doesn't hurt to
>> keep
>> the function for future use) and use the remap for RealFFT,
>> InverseRealFFT,
>> and PowerSpectrum functions.
>
> So am I right in thinking that we never need complex-complex transforms
> on audio because the imaginary part of the time-domain data has no
> physical meaning, and in practise is always zero? We obviously do need
> complex data in the frequency domain (i.e. magnitude and phase of each
> frequency) in order to preserve the phase relationship between different
> frequencies, i.e. obtain the correct phase response for the various
> filters.
>
> The testing I've done with the latest CVS suggests that this is all in
> order - I can create two tracks based on the same tones but with a phase
> shift in one, filter them both and still see the different waveforms
> afterwards.
>
> If in the future we want to allow users to define the phase response of
> filters in the equaliser (in order to replicate that of analogue filters
> for example), then we will need to define and accept complex (i.e. real
> and imaginary parts) curve definitions, so keeping the complex-complex
> versions might well be useful.
>
> Richard
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel 


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Doc Nelson-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
In reply to this post by Philip Van Baren-2
How can I get a copy of Audacity with this new FFT code? Very nice addition

--
Gary Nelson
Porpoise Research Institute
Port Townsend, WA, 98368


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Gale (Audacity Team)

Re: New FFT function

Reply Threaded More More options
Print post
Permalink

"Doc Nelson-2" asked:
> How can I get a copy of Audacity with this new FFT code?

Nightly builds:
http://audacityteam.org/wiki/index.php?title=Nightly_Builds

or on Linux, compile from CVS HEAD:
http://audacity.sourceforge.net/community/developers#cvs


Gale
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
I've committed a change which uses #define EXPERIMENTAL_USE_REALFFTF to
switch the remaining FFT functions calls between the existing FFT function
and the new RealFFTf function.  It is commented out by default - enable it
in Experimental.h

Rough benchmarking shows PlotSpectrum is about 1.2x faster with the spectrum
plot, and about 2x faster for the cepstrum and autocorrelation plots.

Phil


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Phil

I think you should turn it on, nobody else is going to as they don't
know the code as well as you do.  If things go wrong then you/we can
always turn it off again easily, or fix the problem.

Or are you just parking it there for some future use?

But I'm a 'commit and be dammed' sort of person.

TTFN
Martyn

Philip Van Baren wrote:

> I've committed a change which uses #define EXPERIMENTAL_USE_REALFFTF to
> switch the remaining FFT functions calls between the existing FFT function
> and the new RealFFTf function.  It is commented out by default - enable it
> in Experimental.h
>
> Rough benchmarking shows PlotSpectrum is about 1.2x faster with the spectrum
> plot, and about 2x faster for the cepstrum and autocorrelation plots.
>
> Phil
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Philip Van Baren

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
I've gone ahead and turned on EXPERIMENTAL_USE_REALFFTF by default.

I also submitted a change (also controlled via this flag) to WaveClip.*
which optimizes the SpecCache calculations.  By my benchmarks this gives a
1.6x speedup in the SpecCache updates.

A few notes on the WaveClip patch:

1) I changed the scaling of the Spectrogram such that a full scale sine wave
will give a full scale (white) line on the spectrogram.  The previous code
didn't scale at all, so the amplitudes depended on the FFT length, and
generally clipped the spectrum at somewhere around -40dB.

2) Due to (1) the spectrum will look darker than before.  I think the proper
thing to do would be to define full scale and dB range configuration
variables in the spectrogram preferences dialog, so individual users can
tune the display to their taste.

3) I didn't modify the autocorrelation=1 code yet, so that will be as slow
as before (except for the gains from the previously the submitted RealFFTf
changes).

4) The previous ComputeSpectrum() code had provisions for computing the
average spectrum of larger blocks of data (i.e. the data width could be
longer than the FFT length).  This averaging function is not active (data
width and FFT length are passed from the same variable) so I did not
implement it in my new code.


-----Original Message-----
From: Martyn Shaw [mailto:[hidden email]]
Sent: Friday, July 03, 2009 7:49 PM
To: [hidden email]
Subject: Re: [Audacity-devel] New FFT function

Phil

I think you should turn it on, nobody else is going to as they don't
know the code as well as you do.  If things go wrong then you/we can
always turn it off again easily, or fix the problem.

Or are you just parking it there for some future use?

But I'm a 'commit and be dammed' sort of person.

TTFN
Martyn

Philip Van Baren wrote:
> I've committed a change which uses #define EXPERIMENTAL_USE_REALFFTF to
> switch the remaining FFT functions calls between the existing FFT function

> and the new RealFFTf function.  It is commented out by default - enable it

> in Experimental.h
>
> Rough benchmarking shows PlotSpectrum is about 1.2x faster with the
spectrum
> plot, and about 2x faster for the cepstrum and autocorrelation plots.
>
> Phil
>
>
>
----------------------------------------------------------------------------
--
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

----------------------------------------------------------------------------
--
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel


------------------------------------------------------------------------------
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
Martyn Shaw-2

Re: New FFT function

Reply Threaded More More options
Print post
Permalink
Hi Phil (again)

Philip Van Baren wrote:
> I've gone ahead and turned on EXPERIMENTAL_USE_REALFFTF by default.

Good.  If you aren't around in (say) a years time and somebody does a
cleanup they'll say 'Yo, that been in here a year and hasn't caused a
problem, we'll get rid of the EXPERIMENTAL.  Or not.

> I also submitted a change (also controlled via this flag) to WaveClip.*
> which optimizes the SpecCache calculations.  By my benchmarks this gives a
> 1.6x speedup in the SpecCache updates.
>
> A few notes on the WaveClip patch:
>
> 1) I changed the scaling of the Spectrogram such that a full scale sine wave
> will give a full scale (white) line on the spectrogram.  The previous code
> didn't scale at all, so the amplitudes depended on the FFT length, and
> generally clipped the spectrum at somewhere around -40dB.

Still look 'OKish' to me.  Some more colour resolution would be good.

> 2) Due to (1) the spectrum will look darker than before.  I think the proper
> thing to do would be to define full scale and dB range configuration
> variables in the spectrogram preferences dialog, so individual users can
> tune the display to their taste.

That's a good idea, and plenty of room on the spectrogram preferences
dialog.

TTFN
Martyn

> 3) I didn't modify the autocorrelation=1 code yet, so that will be as slow
> as before (except for the gains from the previously the submitted RealFFTf
> changes).
>
> 4) The previous ComputeSpectrum() code had provisions for computing the
> average spectrum of larger blocks of data (i.e. the data width could be
> longer than the FFT length).  This averaging function is not active (data
> width and FFT length are passed from the same variable) so I did not
> implement it in my new code.
>
>
> -----Original Message-----
> From: Martyn Shaw [mailto:[hidden email]]
> Sent: Friday, July 03, 2009 7:49 PM
> To: [hidden email]
> Subject: Re: [Audacity-devel] New FFT function
>
> Phil
>
> I think you should turn it on, nobody else is going to as they don't
> know the code as well as you do.  If things go wrong then you/we can
> always turn it off again easily, or fix the problem.
>
> Or are you just parking it there for some future use?
>
> But I'm a 'commit and be dammed' sort of person.
>
> TTFN
> Martyn
>
> Philip Van Baren wrote:
>> I've committed a change which uses #define EXPERIMENTAL_USE_REALFFTF to
>> switch the remaining FFT functions calls between the existing FFT function
>
>> and the new RealFFTf function.  It is commented out by default - enable it
>
>> in Experimental.h
>>
>> Rough benchmarking shows PlotSpectrum is about 1.2x faster with the
> spectrum
>> plot, and about 2x faster for the cepstrum and autocorrelation plots.
>>
>> Phil
>>
>>
>>
> ----------------------------------------------------------------------------
> --
>> _______________________________________________
>> audacity-devel mailing list
>> [hidden email]
>> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>>
>
> ----------------------------------------------------------------------------
> --
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>
>
> ------------------------------------------------------------------------------
> _______________________________________________
> audacity-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/audacity-devel
>

------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge  
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full prize
details at: http://p.sf.net/sfu/blackberry
_______________________________________________
audacity-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/audacity-devel
1 2