Chris Barrett wrote:> How do I use the sinc function to change the sample rate of a signal?Julius O. Smith has a description of one algorithm: http://ccrma.stanford.edu/~jos/resample/> I've been told that to change the sample rate of a signal I'm suppose to > convolve it with the sinc function.Sample rate conversion requires filtering. One way to get an approriate FIR filter is to apply a window to a scaled sinc function. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Mutable state is actually another form of manual memory management: every time you over-write a value you are making a decision that the old value is now garbage, regardless of what other part of the program might have been using it." -- Paul Johnson
Change Sample Rate
Started by ●July 11, 2007
Reply by ●July 11, 20072007-07-11
Reply by ●July 11, 20072007-07-11
Erik de Castro Lopo wrote:> Julius O. Smith has a description of one algorithm: > > http://ccrma.stanford.edu/~jos/resample/I should also mention that there is working source code here: http://www.mega-nerd.com/SRC/ The code is licensed under the GNU General Public License or alternatively a very affordable commercial use license is also available. Erik -- ----------------------------------------------------------------- Erik de Castro Lopo ----------------------------------------------------------------- "Patents are bad for the software industry.." -- Bill Gates in 1991
Reply by ●July 11, 20072007-07-11
"Ron N." <rhnlogic@yahoo.com> wrote in news:1184191178.484927.283240 @j4g2000prf.googlegroups.com:> The full ft of > your rect chopped interp result will actually have > more high frequency alias content then the "ringy" > looking sincresample result.???>> fftsinc=fft(outsinc); >> fftinterp=fft(outinterp); >> plot(20*log10(abs(fftsinc))); >> holdCurrent plot held>> plot(20*log10(abs(fftinterp)),'r');The interp result looks a solid 40 dB better at high frequency for the rect window. When I apply a 64 point hamming to the original signal, much of the "ringing" goes obviously goes away, but I still get maybe 30 dB better high freq performance from interp.>> y=sin(2*pi*3*x).*window(@hamming,64)'; >> outsinc=sincresample(y',4*length(y)); >> outinterp=interp(y,4); >> fftinterphamming=fft(outinterp); >> fftsinchamming=fft(outsinc); >> plot(20*log10(abs(fftinterphamming)),'r'); >> holdCurrent plot held>> plot(20*log10(abs(fftsinchamming)));Dead on, though, about the bandlimited gauss windowed square wave. -- Scott Reverse name to reply
Reply by ●July 11, 20072007-07-11
As Jerry's post mentioned, any sample rate change is associated with filtering. Typically, - for upsampling, we insert zeros and filter (for removing the images). - for downsampling, we filter (for removing aliases) and skip samples. The type of filter used depends on the rejection requirements on the 'undesired' spectrum. Maybe the post on multirate signal processing @ dspguru will be helpful http://www.dspguru.com/info/faqs/mrfaq.htm Also, you can find some small code snippets @ http://dsplog.blogspot.com/2007/05/polyphase-filters-for-interpolation.html Krishna http://dsplog.blogspot.com






