---------- Forwarded message ----------
From: Andrew Simper <a...@cytomic.com>
Date: 8 May 2012 11:41
Subject: Re: [music-dsp] Wavetable interpolation
To: A discussion list for music-related DSP <music-dsp@music.columbia.edu>


Hi Stephen,

Even if you did want to generate a tone of that is an exact multiple
of the sample rate the buffer you are reading from still needs to be
bandlimited, otherwise all the aliasing energy will not vanish, it
will align with the harmonic content and give you a waveform that is
impossible to create by bandlimited sampling an analog signal.

The easiest example is filling a buffer with a trivial square wave and
playing that back at an exact multiple of the sample rate. Every
transition will be a hard step step ...0 0 1 1.. or ...1 1 0 0 ....
Now if you generated a perfect square wave in analog and then sampled
it using a perfect brickwall filter you can never get such a sharp
transition. I went through the maths and got it wrong and thought
(incorrectly) you could get such a transition, but when Paul Frindle
was adamant it wasn't possible I went through all the maths again and
found where I went wrong (thanks Paul!).

Here is an image of the analytic bandlimited step function to show this:

www.cytomic.com/files/dsp/analytic-bandlimited-step.jpg

Andy
--
cytomic - sound music software


On 8 May 2012 05:45, ChordWizard Software <corpor...@chordwizard.com> wrote:
>
> Hi all,
>
> I am working on a new project using PortAudio and testing it with a waveform 
> stored in a buffer. This could be generated myself (sine, square, sawtooth, 
> etc) or a more complex waveform loaded from a file.
>
> I want to be able to render the waveform at different frequencies, but I can 
> see that I will be limited by quantisation if I just play out the samples 
> themselves.
>
> For example, to generate a 440 Hz tone with sample rate 44100, I need 
> 100.2272727 samples.  This gets rounded to 100 samples, which then produces 
> an actual tone of 441 Hz.
>
> So it looks like I will be needing to interpolate between the samples in the 
> wavetable.  Can someone point me to some discussion or resources on this?
>
> Simple linear interpolation looks easy enough to achieve, but does it 
> introduce an unacceptable level of distortion?  Is there a rule of thumb for 
> minimum numer of samples per waveform to keep artifacts of this type 
> undetectable?
>
> Also, as an aside, is it general practice to calculate sample values with 
> doubles (8 bytes) or are floats (4 bytes) generally adequate?  I'm targeting 
> CD-quality audio (shorts @ 2 bytes) so I'm not sure if the extra precision 
> during calculations helps much.
>
> Regards,
>
> Stephen Clarke
> Managing Director
> ChordWizard Software Pty Ltd
> corpor...@chordwizard.com
> http://www.chordwizard.com
> ph: (+61) 2 4960 9520
> fax: (+61) 2 4960 9580
>
> --
> dupswapdrop -- the music-dsp mailing list and website:
> subscription info, FAQ, source code archive, list archive, book reviews, dsp 
> links
> http://music.columbia.edu/cmc/music-dsp
> http://music.columbia.edu/mailman/listinfo/music-dsp
--
dupswapdrop -- the music-dsp mailing list and website:
subscription info, FAQ, source code archive, list archive, book reviews, dsp 
links
http://music.columbia.edu/cmc/music-dsp
http://music.columbia.edu/mailman/listinfo/music-dsp

Reply via email to