Wayne Foletta wrote: >Mike Keitz is right on the fundamentals of simple resampling - linear >interpolation does work. You only need to use more complex DSP routines >if you want to account for sampling aperture (sinc 1/fs rolloff) and >sample resolution. If the human eye is the observer, 8 bits and linear >resampling is transparent Surely the ideal way to do a general resample of the data is via Fourier Transforms? A fourier transform of your n sample points gives you the amplitudes of the n/2 freqencies the data contains. You can regenerate data between samples by summing the sine and cosine values of each of these freqencies at the given time you need a new data-point. The fourier transform contains ALL the information contained in the original data, so what you regenerate will be (calculation accuracy permitting) as correct as it can be. So each time you want to shuffle the data down the buffer, you need to do an FT and an inverse FT (lots of trig calculations for each point.) The Fast Fourier algorithm will simplify the first part (anyone implemented an FFT on a PIC?). You might speed up the second part with trig look-up tables. I think this is going to be SLOW. I also think that any other resampling approach MUST fail, because other interpolation methods will introduce contributions that are not present in the data (like aliasing errors). After a few shuffles, this random garbage will swamp the original data. (Even with FFT's your rounding errors are cumulative.) The samples representing early data in your buffer (the ones that have been shuffled the most) will bear no resemblance to the original data. Very pretty, but worse than useless because they will be misleading. There is a more general problem with data sampling: Unfortunately, with a small fixed number (n) of samples you can only keep information about a small (n/2) fixed number of freqencies in your data. These will be equally spaced in the spectrum up to half your sampling rate. Clearly you want to stop sampling before the highest frequency contained in the data (half the current sampling rate) falls below the highest frequency you're interested in. You won't know when this is, unless you already know something about the data. But if you already know what freqencies you want to sample you can just pick the right sampling rate from the start! If you don't know anything about the data (frequency-wise) then you can NEVER be sure that you've sampled at a freqency that captures the features you might be looking for. Any comments anyone? Alec =========================================================================== ________ / ______/ W5 Ltd. ______ ______ _ / /___ \ \ / \ / /____ \ 33 Sneath Avenue \ \ / \ / __ / / London NW11 9AJ \ \ / \ / / /_/ / United Kingdom \ \/ /\ \/ \_____/ \ / \ / Telephone +44 181 922 7778 \ / \ / Fax +44 976 650 110 \______/ \_______/ eMail mail@W5.co.uk Technology * Innovation * Design * Solutions