DSPRelated.com
Forums

Sample Rate Conversion by non integer factor

Started by David Reid June 30, 2004
"Ronald H. Nicholson Jr." <rhn@mauve.rahul.net> wrote in message
news:cc1q5u$8k1$1@blue.rahul.net...
> In article <W6CEc.179470$207.1255211@news20.bellglobal.com>, > > On a fast > PC you may not need to do this, as a well tuned math library can often > calculate the window and Sinc tap coefficients in real time.
Just curious, how well does this work with a Kaiser window (my favorite choice for this type of thing)? It's got that nasty Bessel function in it!
David Reid wrote:
> > I have actually. i've also heard of Open source audio library on > sourceforge.net. i think the implementation for the class afLibConverter > (used for sample rate conversion) is a reimplementation of the Secret Rabbit > Code functions in C++.
Actually, I beleive that afLibConverter uses a modified version of Julius O. Smith's original C code and simply provides a C++ wrapper around it. Secret Rabbit Code is the reimplementation and last time I compared my code (the Rabbit) with implementations based on the JOS code, my code ran faster and had better signal to noise and a wider passband. I've been meaning write up these results but I simply haven't had the time.
> Anyway, I've posted the algorithm. don't care if i can't share it. dont > really like this company much....
Que?? Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ When aiming for the common denominator, be prepared for the occasional division by zero.
I have implemented a polynomial interpolator and it works fine for
Audio Sample rate conversion.  You can the material here
http://www.student.oulu.fi/~oniemita/DSP/INDEX.HTM

rhn@mauve.rahul.net (Ronald H. Nicholson Jr.) wrote in message news:<cc1q5u$8k1$1@blue.rahul.net>...
> In article <W6CEc.179470$207.1255211@news20.bellglobal.com>, > David Reid <dreid_nospam@remove_no_spam_mechtronix.ca> wrote: > >How can this be done? My application is converting the sample rate of > >44.1kHz wave files to sample rate X (eg change SR by factor of 0.75, or 1.3) > >and playing back at 44.1kHz, so that the speed sounds different. > > Interpolation can give you any point between sample points, and > thus will work for any arbitrary or even time varying sample ratios. > > Sinc interpolation will produce much less distortion than linear > or low order polynomial interpolation (see the "reconstruction" > theorems), although linear interpolation may work if the frequency > content of the original signal is way below the sample rate. > > An interpolation method with suitable approximations for the > windowed-Sinc function will allow you to trade off compute time against > S/N ratio. You can play with the type of window, width of window and > various approximation tricks for the windowed-Sinc function. The various > polyphase resampling methods are just table-lookup driven optimization > tricks which one can use with DSP's that are too slow (or as an > optimization when needed for power reduction or something). On a fast > PC you may not need to do this, as a well tuned math library can often > calculate the window and Sinc tap coefficients in real time. > > > IMHO. YMMV.
balaji wrote:
> > I have implemented a polynomial interpolator and it works fine for > Audio Sample rate conversion. You can the material here > http://www.student.oulu.fi/~oniemita/DSP/INDEX.HTM
Have you measured the signal to noise ratio? If so, what was it and how did you measure it? Erik -- +-----------------------------------------------------------+ Erik de Castro Lopo nospam@mega-nerd.com (Yes it's valid) +-----------------------------------------------------------+ "And MS thinks Linux is vulnerable to forking? 95, 95 OEM SR2, 98, 98SE, ME, NT, 2000, Bob, .NET, CE, Datacenter, Server, Adv. Server, and now Web Server, sheesh." -- BTS on LinuxToday.com
Jon Harris wrote:
> "Ronald H. Nicholson Jr." wrote: > > > > On a fast > > PC you may not need to do this, as a well tuned math library can often > > calculate the window and Sinc tap coefficients in real time. > > Just curious, how well does this work with a Kaiser window (my favorite choice > for this type of thing)? It's got that nasty Bessel function in it!
Have you tried Knab's alternative to the Kaiser window [1]? It is also a one-parameter window family, but is defined using exp instead of the Bessel I_0 function and is claimed to be very close to the Kaiser window. Regards, Andor [1] John J Knab, "An Alternate Kaiser Window" IEEE Transactions on Acoustics, Speech, and Signal Processing, Vol. ASSP-27, No.5, October 1979
"Andor" <an2or@mailcircuit.com> wrote in message
news:ce45f9ed.0407020150.26f1e6ef@posting.google.com...
> Jon Harris wrote: > > "Ronald H. Nicholson Jr." wrote: > > > > > > On a fast > > > PC you may not need to do this, as a well tuned math library can often > > > calculate the window and Sinc tap coefficients in real time. > > > > Just curious, how well does this work with a Kaiser window (my favorite
choice
> > for this type of thing)? It's got that nasty Bessel function in it! > > Have you tried Knab's alternative to the Kaiser window [1]? It is also > a one-parameter window family, but is defined using exp instead of the > Bessel I_0 function and is claimed to be very close to the Kaiser > window. > > Regards, > Andor > > [1] John J Knab, "An Alternate Kaiser Window" > IEEE Transactions on Acoustics, Speech, and Signal Processing, Vol. > ASSP-27, No.5, October 1979
That's the first I've heard of it. Thanks for the tip!