Hi, I'm trying to implements a pitch shift effect (up / down a .wav sound 44100Hz 16bit to different semitones in the range of around 1 octave). My problem is that I need to do it on about 15 sample simultaneously in real time. The classic pitch shift algorithms use too much of processor time. As my samples are looped, I don't care about the lenght modification of my samples. That's why, I would like too try too change the rate of my samples in real time, but still playing the samples at 44100 Hz. I hope it will produce a pitch shift effect. Do you think it is the good way (using multirate for example from www.dspguru.com) to do it? This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Using Multirate algorithm for doing pitch shift effect ?
Started by ●March 29, 2005
Reply by ●March 31, 20052005-03-31
>Hi, > >I'm trying to implements a pitch shift effect (up / down a .wav sound >44100Hz 16bit to different semitones in the range of around 1 octave). > >My problem is that I need to do it on about 15 sample simultaneously in >real time. >The classic pitch shift algorithms use too much of processor time. >As my samples are looped, I don't care about the lenght modification ofmy>samples. >That's why, I would like too try too change the rate of my samples inreal>time, but still playing the samples at 44100 Hz. I hope it will producea>pitch shift effect. > >Do you think it is the good way (using multirate for example from >www.dspguru.com) to do it? >I tried it but the results are not very good. The volume level sounds to become lower. This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by ●March 31, 20052005-03-31
in article SoednTG9Fco5VNbfRVn-vg@giganews.com, Eudes at youdeseo@yahoo.fr wrote on 03/31/2005 04:57:>> Hi, >> >> I'm trying to implements a pitch shift effect (up / down a .wav sound >> 44100Hz 16bit to different semitones in the range of around 1 octave). >> >> My problem is that I need to do it on about 15 sample simultaneously in >> real time. >> The classic pitch shift algorithms use too much of processor time. >> As my samples are looped, I don't care about the lenght modification of my >> samples.then i wouldn't use the term "pitch shift effect" because that usually means shifting the pitch without changing the length or tempo.>> That's why, I would like too try too change the rate of my samples in real >> time, but still playing the samples at 44100 Hz. I hope it will produce a >> pitch shift effect. >> >> Do you think it is the good way (using multirate for example from >> www.dspguru.com) to do it? >> > > > > > I tried it but the results are not very good. The volume level sounds to > become lower.could be a simple scaling issue. do you understand the interpolation or sample rate conversion problem as commonly presented in a DSP context? because if you don't mind the length modification, then that's all the problem you have and that isn't so hard. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●April 1, 20052005-04-01
> rjb said:>could be a simple scaling issue. do you understand the interpolation or >sample rate conversion problem as commonly presented in a DSP context? >because if you don't mind the length modification, then that's all the >problem you have and that isn't so hard.Hi rjb, thanx a lot for your answer. I'm quite a newbie in dsp, but I know the basics. I think having understood the interpolation problem. However I'm using the Resampling theory because most of my conversion factor are not integer, so I have to use the combination of decimation and interpolation. In my application, I recieve the pitch information by Midi messages. Then I convert it in sampleRate factor between 0.5 and 2. So the M decimation factor and the L interpolation factor are variable. Now my problem is that the output sound is very low and I have the feeling that too much of high frequencies are cuted. That I am note sure to understand is if I need to build another set of filter coefficients for each time I change the sample rate. If needed how I can get them quickly in real time? The Resampling algorithm from Multirate DspGuru, use an interpolate by 25 or 21 filter. But even if I use these M and L factor, the sound is low and I'm not sure that the high cutoff frequency is good. I'm not sure for having given to you enough and understanding details, so don't hesitate to ask more. Eudes This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by ●April 4, 20052005-04-04
Hello, I think that what I need to know is if I need to find new FIR Interpolation filter coeff each time I change the sampling rate ratio. Is the length of the array of the filter coeffs is a variable depending to my interpolation factor? Thanks Eudes This message was sent using the Comp.DSP web interface on www.DSPRelated.com
Reply by ●April 4, 20052005-04-04
in article xqGdnduMrN2cas3fRVn-jw@giganews.com, Eudes at youdeseo@yahoo.fr wrote on 04/04/2005 04:12:> I think that what I need to know is if I need to find new FIR > Interpolation filter coeff each time I change the sampling rate ratio.what you need is a different set of interpolation coefficients for each fractional delay that your sample rate ratio requires. that is if your sample rate ratio was 19/13, then you would need 13 sets of FIR coefficients, one set for each 1/13th sample fractional delay. and you would skip 19 thirteenths of an input sample for each output sample.> Is the length of the array of the filter coeffs is a variable depending to > my interpolation factor?yes, in the manner alluded to above. if your interpolation factor is completely arbitrary, then you need a lot of sets of coefficients (i would say about 512, from my own experience) and you can linearly interpolate between them for whatever precision of fractional delay you want. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●April 4, 20052005-04-04
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message news:BE76BBA8.5DDA%rbj@audioimagination.com...> in article xqGdnduMrN2cas3fRVn-jw@giganews.com, Eudes at youdeseo@yahoo.fr > wrote on 04/04/2005 04:12: > > > I think that what I need to know is if I need to find new FIR > > Interpolation filter coeff each time I change the sampling rate ratio. > > what you need is a different set of interpolation coefficients for each > fractional delay that your sample rate ratio requires. that is if your > sample rate ratio was 19/13, then you would need 13 sets of FIR > coefficients, one set for each 1/13th sample fractional delay. and you > would skip 19 thirteenths of an input sample for each output sample. > > > Is the length of the array of the filter coeffs is a variable depending to > > my interpolation factor? > > yes, in the manner alluded to above. if your interpolation factor is > completely arbitrary, then you need a lot of sets of coefficients (i would > say about 512, from my own experience) and you can linearly interpolate > between them for whatever precision of fractional delay you want.Depending on the quality you desire, you might be able to get away with picking the closest coefficient set and skipping the linear interpolation. This works best of course when you have lots of memory and store many sets of coefficients (e.g. thousands). But r b-j's suggestion of linearly interpolating will get you the best quality results. -- Jon Harris SPAM blocked e-mail address in use. Replace the ANIMAL with 7 to reply.
Reply by ●April 4, 20052005-04-04
in article 1152vfll9n3nif7@corp.supernews.com, Jon Harris at jon_harrisTIGER@hotmail.com wrote on 04/04/2005 13:49:> "robert bristow-johnson" <rbj@audioimagination.com> wrote in message > news:BE76BBA8.5DDA%rbj@audioimagination.com... >> in article xqGdnduMrN2cas3fRVn-jw@giganews.com, Eudes at youdeseo@yahoo.fr >> wrote on 04/04/2005 04:12: >> >>> I think that what I need to know is if I need to find new FIR >>> Interpolation filter coeff each time I change the sampling rate ratio. >> >> what you need is a different set of interpolation coefficients for each >> fractional delay that your sample rate ratio requires. that is if your >> sample rate ratio was 19/13, then you would need 13 sets of FIR >> coefficients, one set for each 1/13th sample fractional delay. and you >> would skip 19 thirteenths of an input sample for each output sample. >> >>> Is the length of the array of the filter coeffs is a variable depending to >>> my interpolation factor? >> >> yes, in the manner alluded to above. if your interpolation factor is >> completely arbitrary, then you need a lot of sets of coefficients (i would >> say about 512, from my own experience) and you can linearly interpolate >> between them for whatever precision of fractional delay you want. > > Depending on the quality you desire, you might be able to get away with > picking the closest coefficient set and skipping the linear interpolation. > This works best of course when you have lots of memory and store many sets of > coefficients (e.g. thousands). But r b-j's suggestion of linearly > interpolating will get you the best quality results.there is a paper that Duane Wise and i did back in the 90's and Olli Niemitalo picked up on (link below) that tries to spell out the trade offs on this. http://www.biochem.oulu.fi/~oniemita/dsp/deip.pdf for 120 dB S/N in arbitrary ratio resampling, i have found that an oversampling ratio of 512 was good enough for linear interpolation and, IIRC, it was 512K for drop-sample (or Zero-order hold) interpolation. of course, the first requires two FIRs before linearly interpolating, and the latter is one FIR (and no further interpolation). the FIR lengths might be as high as 32, so (considereing coefficient symmetry) you nead 8193 words for the upsample ratio of 512 (linear) and 512K*32/2+1 words for drop-sample. -- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."
Reply by ●April 4, 20052005-04-04
"robert bristow-johnson" <rbj@audioimagination.com> wrote in message news:BE771538.5E15%rbj@audioimagination.com...> in article 1152vfll9n3nif7@corp.supernews.com, Jon Harris at > jon_harrisTIGER@hotmail.com wrote on 04/04/2005 13:49: > > > "robert bristow-johnson" <rbj@audioimagination.com> wrote in message > > news:BE76BBA8.5DDA%rbj@audioimagination.com... > >> in article xqGdnduMrN2cas3fRVn-jw@giganews.com, Eudes at youdeseo@yahoo.fr > >> wrote on 04/04/2005 04:12: > >> > >>> I think that what I need to know is if I need to find new FIR > >>> Interpolation filter coeff each time I change the sampling rate ratio. > >> > >> what you need is a different set of interpolation coefficients for each > >> fractional delay that your sample rate ratio requires. that is if your > >> sample rate ratio was 19/13, then you would need 13 sets of FIR > >> coefficients, one set for each 1/13th sample fractional delay. and you > >> would skip 19 thirteenths of an input sample for each output sample. > >> > >>> Is the length of the array of the filter coeffs is a variable depending to > >>> my interpolation factor? > >> > >> yes, in the manner alluded to above. if your interpolation factor is > >> completely arbitrary, then you need a lot of sets of coefficients (i would > >> say about 512, from my own experience) and you can linearly interpolate > >> between them for whatever precision of fractional delay you want. > > > > Depending on the quality you desire, you might be able to get away with > > picking the closest coefficient set and skipping the linear interpolation. > > This works best of course when you have lots of memory and store many setsof> > coefficients (e.g. thousands). But r b-j's suggestion of linearly > > interpolating will get you the best quality results. > > there is a paper that Duane Wise and i did back in the 90's and Olli > Niemitalo picked up on (link below) that tries to spell out the trade offs > on this. > > http://www.biochem.oulu.fi/~oniemita/dsp/deip.pdfThat's a good paper!> for 120 dB S/N in arbitrary ratio resampling, i have found that an > oversampling ratio of 512 was good enough for linear interpolation and, > IIRC, it was 512K for drop-sample (or Zero-order hold) interpolation. of > course, the first requires two FIRs before linearly interpolating, and the > latter is one FIR (and no further interpolation).Alternatively, you can interpolate the coefficients first, then run a single FIR. This saves computations if you need to resample more than one channel of audio (using the same parameters). Otherwise, it's a wash.> the FIR lengths might be > as high as 32, so (considereing coefficient symmetry) you nead 8193 words > for the upsample ratio of 512 (linear) and 512K*32/2+1 words for > drop-sample.-- Jon Harris SPAM blocked e-mail address in use. Replace the ANIMAL with 7 to reply.
Reply by ●April 5, 20052005-04-05
in article 115394mekil1vfd@corp.supernews.com, Jon Harris at jon_harrisTIGER@hotmail.com wrote on 04/04/2005 16:34:>> there is a paper that Duane Wise and i did back in the 90's and Olli >> Niemitalo picked up on (link below) that tries to spell out the trade offs >> on this. >> >> http://www.biochem.oulu.fi/~oniemita/dsp/deip.pdf > > That's a good paper!yeah, he did a really good (exhaustive) job. one thing that i tossed into Duane and my paper was a little handwavy theory to what the performance of different polynomial interpolators would look like. drop-sample you get 6 dB S/N for every octave of oversampling and linear interpolation you get 12 dB (with a couple of constant offsets), but the (crude) theory was in the ballpark of the numerically integrated results. the purpose was just to give me an idea of how many polyphases i needed to do arbitrary sample-rate conversion.>> for 120 dB S/N in arbitrary ratio resampling, i have found that an >> oversampling ratio of 512 was good enough for linear interpolation and, >> IIRC, it was 512K for drop-sample (or Zero-order hold) interpolation. of >> course, the first requires two FIRs before linearly interpolating, and the >> latter is one FIR (and no further interpolation). > > Alternatively, you can interpolate the coefficients first, then run a single > FIR. This saves computations if you need to resample more than one channel of > audio (using the same parameters). Otherwise, it's a wash. >-- r b-j rbj@audioimagination.com "Imagination is more important than knowledge."