<div dir="ltr">If it's a single cycle waveform, I'd recommend FFT resampling (compute the real FFT, truncate, take the inverse real FFT). Why? Because this is the only method that assumes that there's a continuity between the first and last sample of your time series - that your waveform "wraps around". This will create wiggles (Gibbs phenomenon) near the edges, but so does a super steep ideal filter. You can deal with it by applying a tapering function to the spectrum in the frequency domain.<div><br></div><div>Python code here (it creates a graph.png file with the original and resampled waveforms, without and with frequency domain taper):</div><div><a href="https://repl.it/@OlivierGillet/Resampling-of-single-cycle-waveforms">https://repl.it/@OlivierGillet/Resampling-of-single-cycle-waveforms</a><br><br>If you want to use the resample function, concatenate several copies of your waveform to avoid edge effects. You'll have to know the exact latency of the resampling filter to find where your waveform starts.</div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 19, 2018 at 8:39 PM, Richie Burnett <span dir="ltr"><<a href="mailto:rburnett@richieburnett.co.uk" target="_blank">rburnett@richieburnett.co.uk</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks Eric. I didn't know it had this built-in function. I'll give it a try on MATLAB tomorrow at work :-)<br>
<span class="im HOEnZb"><br>
Sent from my Xperia SP on O2<br>
<br>
</span><div class="HOEnZb"><div class="h5">---- Eric Brombaugh wrote ----<br>
<br>
>Richie,<br>
><br>
>Matlab & Octave have a variety of different ways to do interpolation / <br>
>decimation. The resample() function that I suggested does rational <br>
>resampling - the p & q arguments tell the upsampling and downsampling <br>
>rates with a lowpass antialias FIR filter that's tailored to the p & q <br>
>requirements. There are optional arguments that allow further refinement <br>
>of the filter characteristics, but with the simplest call it's pretty <br>
>close to an optimum sinc interpolation.<br>
><br>
>Eric<br>
><br>
>On 04/19/2018 11:18 AM, Richie Burnett wrote:<br>
>> Eric, What resampling method does octave use internally? Sinc? Linear interpolation? Etc...<br>
>> <br>
>> ---- Eric Brombaugh wrote ----<br>
>> <br>
>>> Install a copy of Gnu Octave:<br>
>>><br>
>>> <a href="https://www.gnu.org/software/octave/" rel="noreferrer" target="_blank">https://www.gnu.org/software/<wbr>octave/</a><br>
>>><br>
>>> Write a quick script to read a .wav file, resample and write it out. Use<br>
>>> these functions:<br>
>>><br>
>>> y = wavread (filename)<br>
>>><br>
>>> [y, h] = resample (x, p, q)<br>
>>><br>
>>> wavwrite (y, filename)<br>
>>><br>
>>> Done.<br>
>>><br>
>>><br>
>>><br>
>>> On 04/19/2018 10:29 AM, Tim Ressel wrote:<br>
>>>> Hi,<br>
>>>><br>
>>>> Looks like there's some DSP in my future. I need to resample wave files<br>
>>>> to get them from 600 samples down to 256 samples. Unless there is a<br>
>>>> groovy toll out there that can do that, I gotta write an app for it. As<br>
>>>> far as I can tell I need to interpolate 32x and then decimate 75x, with<br>
>>>> all the attendant filters that these processes need. I know just enough<br>
>>>> DSP to be dangerous.<br>
>>>><br>
>>>> Thoughts?<br>
>>>><br>
>>><br>
>>> ______________________________<wbr>_________________<br>
>>> Synth-diy mailing list<br>
>>> <a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br>
>>> <a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/<wbr>listinfo/synth-diy</a><br>
><br>
<br>
______________________________<wbr>_________________<br>
Synth-diy mailing list<br>
<a href="mailto:Synth-diy@synth-diy.org">Synth-diy@synth-diy.org</a><br>
<a href="http://synth-diy.org/mailman/listinfo/synth-diy" rel="noreferrer" target="_blank">http://synth-diy.org/mailman/<wbr>listinfo/synth-diy</a><br>
</div></div></blockquote></div><br></div>