From: David R. Sky <davidsky@sh...>  20060321 08:08:40

Hi, I'd like to help the sender of the following email in creating the plugin he describes, but there are several things I don't yet understand. I'm not experienced enough with Nyquist/dsp yet to understand much of what Gary is talking about, and I'd like to learn. Is there somewhere in particular any of you would suggest starting (to learn)? Thanks David  Forwarded message  From: Gary Nelson < Subject: RE: [Audacityusers] Antialiasing Finite Impulse Response (FIR) filter David We need to convolve the impulse response of our FIR filter with the audio file in 32bit floating mode. The impulse response is an even function so we add a pair of samples to left and right of a center point and multiply by a filter coefficient. A trivial filter would have three coefficients, say .25, .5, .25. The coefficients add to 1 so that the filter has unity gain. We can make the filter have any gain by making the sum of the filter coefficients equal the desired gain. To convolve this filter with a file of audio samples, we would pad the file with an extra zero sample at each end, then position the filter centered on the first sample, add the sample to the left to the sample to the right, multiply by .25 and add the center sample * .5 to get the first filtered result. Then move the filter to the right one sample and do it again to create the second output sample. Slide the filter past all the audio samples to create the filtered output. If we want to discard every other sample, we can slide the filter to the right 2 samples to create the second desired output. The filter we will want to use will also have an odd number of samples where all the sample pairs at equal distances from the center will have the same value  ie, if we folded the impulse response about the center sample, the halves would be identical. That is the definition of an even function. The filter we want will have perhaps 1001 or so samples, but the concept will be the same as the trivial example above. What say we make the trivial example work to get the concept and structure of the solution, then expand to any number of samples. We can test the results by using the <Generate white noise> function and run our filter over it and then plot the spectrum. Also, if we can put the impulse response in an audio file and run the spectrum, we will see the transfer function of the filter. I think we want to make this filter start rolling off at about 19kHz and be down 100 dB by 22kHz and have no funny side lobes above 22.05kHz that will alias back into our audio band. Let's make this work without the decimation (bimation) first, and then add that feature. I don't understand how we will change the resulting file characteristics to say that its sample rate is 44.1 instead of 88.2. The file will be half as long and that also will need to be handled. I have perused the Nyquist documents and a couple examples, but can't say that I have any idea how to do this problem. I wrote a lot of these filter algorithms in assembly language years ago but am rusty to say the least. Thanks Gary Nelson  This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.asus.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642  Mailing list: Audacityusers@... To UNSUBSCRIBE, use the form at the bottom of this web page: https://lists.sourceforge.net/lists/listinfo/audacityusers 
RE: [Audacitynyquist] RE: [Audacityusers] Antialiasing Finite Impulse Response (FIR) filter (fwd)
From: Gary Nelson <gnelson@qu...>  20060321 16:26:32

David Thanks. I have followed your move to this list. Is there any filter program we can start with to see how filtering is done? Apparently Nyquist is an interpreted language? Is there any compiled version that we can use after we understand what wants to be done and we need to get more speed? Thanks Gary Original Message From: audacitynyquistadmin@... [mailto:audacitynyquistadmin@...] On Behalf Of David R. Sky Sent: Tuesday, March 21, 2006 12:09 AM To: Audacitynyquist@... Subject: [Audacitynyquist] RE: [Audacityusers] Antialiasing Finite Impulse Response (FIR) filter (fwd) Hi, I'd like to help the sender of the following email in creating the plugin he describes, but there are several things I don't yet understand. I'm not experienced enough with Nyquist/dsp yet to understand much of what Gary is talking about, and I'd like to learn. Is there somewhere in particular any of you would suggest starting (to learn)? Thanks David  Forwarded message  From: Gary Nelson < Subject: RE: [Audacityusers] Antialiasing Finite Impulse Response (FIR) filter David We need to convolve the impulse response of our FIR filter with the audio file in 32bit floating mode. The impulse response is an even function so we add a pair of samples to left and right of a center point and multiply by a filter coefficient. A trivial filter would have three coefficients, say .25, .5, .25. The coefficients add to 1 so that the filter has unity gain. We can make the filter have any gain by making the sum of the filter coefficients equal the desired gain. To convolve this filter with a file of audio samples, we would pad the file with an extra zero sample at each end, then position the filter centered on the first sample, add the sample to the left to the sample to the right, multiply by .25 and add the center sample * .5 to get the first filtered result. Then move the filter to the right one sample and do it again to create the second output sample. Slide the filter past all the audio samples to create the filtered output. If we want to discard every other sample, we can slide the filter to the right 2 samples to create the second desired output. The filter we will want to use will also have an odd number of samples where all the sample pairs at equal distances from the center will have the same value  ie, if we folded the impulse response about the center sample, the halves would be identical. That is the definition of an even function. The filter we want will have perhaps 1001 or so samples, but the concept will be the same as the trivial example above. What say we make the trivial example work to get the concept and structure of the solution, then expand to any number of samples. We can test the results by using the <Generate white noise> function and run our filter over it and then plot the spectrum. Also, if we can put the impulse response in an audio file and run the spectrum, we will see the transfer function of the filter. I think we want to make this filter start rolling off at about 19kHz and be down 100 dB by 22kHz and have no funny side lobes above 22.05kHz that will alias back into our audio band. Let's make this work without the decimation (bimation) first, and then add that feature. I don't understand how we will change the resulting file characteristics to say that its sample rate is 44.1 instead of 88.2. The file will be half as long and that also will need to be handled. I have perused the Nyquist documents and a couple examples, but can't say that I have any idea how to do this problem. I wrote a lot of these filter algorithms in assembly language years ago but am rusty to say the least. Thanks Gary Nelson  This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.asus.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642  Mailing list: Audacityusers@... To UNSUBSCRIBE, use the form at the bottom of this web page: https://lists.sourceforge.net/lists/listinfo/audacityusers  This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.asus.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ Audacitynyquist mailing list Audacitynyquist@... https://lists.sourceforge.net/lists/listinfo/audacitynyquist 
RE: [Audacitynyquist] RE: [Audacityusers] Antialiasing Finite
Impulse Response (FIR) filter (fwd)
From: David R. Sky <davidsky@sh...>  20060321 17:17:33

Gary wrote: > Thanks. I have followed your move to this list. > Is there any filter program we can start with to see how filtering is done? David: It sounds like you want some type of lowpass filter. There are several which are readytowork in Audacity: lp, lowpass2, lowpass4, lowpass6 and lowpass8, from single to 8pole Butterworth. (The lowpass filter under the Audacity effects menu uses the lp function. In Audacity, the sound which has been selected is by default 's'. If we call the cutoff frequency 'f', lp works like this: (lp s f) which works on mono and stereo signals. Lowpass2 through lowpass8 need a bit of code addition in order to work on stereo audio, but that's quite simple. You can test what the effects of running any Nyquist function by first selecting some audio in Audacity then using the Nyquist Prompt under the effects menu. With each of these lowpass filters the layout is the same: lowpass function, s, cutoff frequency. For instance: (lowpass2 s 1000) Gary: > Apparently Nyquist is an interpreted language? Is there any compiled > version that we can use after we understand what wants to be done and we > need to get more speed? > David: Yes, there is a 'standalone' version of Nyquist, which can be accessed somewhere on Roger Dannenberg's website http://www.cs.cmu.edu/~music/nyquist I may have missed an 'rbd/' before the music/. I have rarely used the standalone version because it doesn't work with my screen reader. In regard to processing at 88.2 khz, I think that can be done using 'forcesrate' (forcesrate 88200 {other code}) I _suspect_ you could try this with a lowpass filter: (forcesrate 88200 (lp s 44100)) which I think means 'apply a singlepole lowpass filter at cutoff frequency 44.1khz and sampling rate of 88.2khz'. I'm not sure if you already need your audio to have been sampled at 88.2khz. David 
From: Gary Nelson <gnelson@qu...>  20060321 19:12:42

David, I have the source for your Buzz Generator. I wonder if we could tag up by phone. I would appreciate a walk through of that code to understand how it works. I don't see how to get it into Audacity. I can call you as I have a flat rate phone service as long as you are in the US GN 
From: Alex S. Brown <alexsbrown@al...>  20060321 20:35:18

Gary, Besides using the standalone Nyquist, you can also write compiled plug ins for Audacity or for Nyquist itself. In that way you could use Nyquist as a prototyping language and then write a compilable version in C or some other language. Audacity supports LADSPA and VST plugins. See http://audacity.sourceforge.net/download/plugins for details. I do not know how to write them, but I understand these plugins can be authored and compiled. The full Nyquist documentation, which comes with the standalone package, includes instructions on how to write plugins for Nyquist. That might be the best of both worlds for you. You can read more in Appendix 1: http://www.cs.cmu.edu/~rbd/doc/nyquist/part14.html#139 If you review the whole documentation set, you will find other ways to link Nyquist into other libraries. Here is the main online documentation group: http://www.cs.cmu.edu/~rbd/doc/nyquist/root.html I see ways to call C routines, if you need to. I emphasize that I have never done these extensions myself, and some may not work with Audacity's version of Nyquist, but they are tools to try out. Quoting "David R. Sky" <davidsky@...>: > Gary wrote: > > Apparently Nyquist is an interpreted language? Is there any compiled > > version that we can use after we understand what wants to be done and we > > need to get more speed? > > > David: > Yes, there is a 'standalone' version of Nyquist, which can be accessed > somewhere on Roger Dannenberg's website > > http://www.cs.cmu.edu/~music/nyquist >  Alex S. Brown, PMP alexsbrown@... http://www.alexsbrown.com/ http://www.linkedin.com/in/alexsbrown 