[sdiy] resampling wav files
Olivier Gillet
ol.gillet at gmail.com
Thu Apr 19 22:56:22 CEST 2018
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.
Python code here (it creates a graph.png file with the original and
resampled waveforms, without and with frequency domain taper):
https://repl.it/@OlivierGillet/Resampling-of-single-cycle-waveforms
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.
On Thu, Apr 19, 2018 at 8:39 PM, Richie Burnett <
rburnett at richieburnett.co.uk> wrote:
> Thanks Eric. I didn't know it had this built-in function. I'll give it a
> try on MATLAB tomorrow at work :-)
>
> Sent from my Xperia SP on O2
>
> ---- Eric Brombaugh wrote ----
>
> >Richie,
> >
> >Matlab & Octave have a variety of different ways to do interpolation /
> >decimation. The resample() function that I suggested does rational
> >resampling - the p & q arguments tell the upsampling and downsampling
> >rates with a lowpass antialias FIR filter that's tailored to the p & q
> >requirements. There are optional arguments that allow further refinement
> >of the filter characteristics, but with the simplest call it's pretty
> >close to an optimum sinc interpolation.
> >
> >Eric
> >
> >On 04/19/2018 11:18 AM, Richie Burnett wrote:
> >> Eric, What resampling method does octave use internally? Sinc? Linear
> interpolation? Etc...
> >>
> >> ---- Eric Brombaugh wrote ----
> >>
> >>> Install a copy of Gnu Octave:
> >>>
> >>> https://www.gnu.org/software/octave/
> >>>
> >>> Write a quick script to read a .wav file, resample and write it out.
> Use
> >>> these functions:
> >>>
> >>> y = wavread (filename)
> >>>
> >>> [y, h] = resample (x, p, q)
> >>>
> >>> wavwrite (y, filename)
> >>>
> >>> Done.
> >>>
> >>>
> >>>
> >>> On 04/19/2018 10:29 AM, Tim Ressel wrote:
> >>>> Hi,
> >>>>
> >>>> Looks like there's some DSP in my future. I need to resample wave
> files
> >>>> to get them from 600 samples down to 256 samples. Unless there is a
> >>>> groovy toll out there that can do that, I gotta write an app for it.
> As
> >>>> far as I can tell I need to interpolate 32x and then decimate 75x,
> with
> >>>> all the attendant filters that these processes need. I know just
> enough
> >>>> DSP to be dangerous.
> >>>>
> >>>> Thoughts?
> >>>>
> >>>
> >>> _______________________________________________
> >>> Synth-diy mailing list
> >>> Synth-diy at synth-diy.org
> >>> http://synth-diy.org/mailman/listinfo/synth-diy
> >
>
> _______________________________________________
> Synth-diy mailing list
> Synth-diy at synth-diy.org
> http://synth-diy.org/mailman/listinfo/synth-diy
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://synth-diy.org/pipermail/synth-diy/attachments/20180419/fc075664/attachment.htm>
More information about the Synth-diy
mailing list