Re: [music-dsp] Antialias question (Kevin Chi)

2018-06-01 Thread robert bristow-johnson







 Original Message 

Subject: Re: [music-dsp] Antialias question (Kevin Chi)

From: "Kevin Chi" 

Date: Fri, June 1, 2018 2:50 pm

To: music-dsp@music.columbia.edu

--



> Thanks Frank,

>

> I use cubic interpolation to interpolate between samples and it seems a

> bit better than linear for me. I am more worried

> about the downsampling, when the playhead is going faster than the

> original samplerate
or the output pointer ("playhead") is moving faster than the input pointer 
("recordhead").� the latter is always moving at a rate of one sample 
displacement per sample period.� the former, the output pointer has both 
integer and fractional
parts.� the integer part of the output pointer tells you which samples you are 
going to combine, and the fractional part tells you how you will be combining 
them.

>� and that's

> when the high frequencies of the original material start to fold back at

> Nyquist to cause aliasing.

>

> My concern is if it would be a constant pitching up (downsample) rate

> then it would be "easy" to apply an

> antialias filter based on the resampling rate. But as the resampling

> rate can change by every step (as the speed of the

> playhead is modulating), you should apply different antialias filters

> for every step. Or at least the filter needs to use

> different coefficients every time it's applied... That's what I am

> unsure of what is the best solution to solve.
�
what you can do, but it's a little expensive, is when your output pointer 
stepsize is larger than one, cut that step size in half and compute two 
samples.� lowpass filter that stream of samples and pick out every other
sample, discarding the samples in between.
�
--

r b-j� � � � � � � � � � � � �r...@audioimagination.com



"Imagination is more important than knowledge."

�
�
�
�
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Antialias question (Kevin Chi)

2018-06-01 Thread Kevin Chi

Thanks Frank,

I use cubic interpolation to interpolate between samples and it seems a 
bit better than linear for me. I am more worried
about the downsampling, when the playhead is going faster than the 
original samplerate and that's
when the high frequencies of the original material start to fold back at 
Nyquist to cause aliasing.


My concern is if it would be a constant pitching up (downsample) rate 
then it would be "easy" to apply an
antialias filter based on the resampling rate. But as the resampling 
rate can change by every step (as the speed of the
playhead is modulating), you should apply different antialias filters 
for every step. Or at least the filter needs to use
different coefficients every time it's applied... That's what I am 
unsure of what is the best solution to solve.


--
Kevin



/Hi Kevin. />//>/I'm the least-expert guy here I'm sure, but as a fellow newbie I might />/have some newbie-level ideas for you. />//>/Just to mention something simple: linear interpolating between samples is />/a huge improvement in reducing aliasing over not interpolating. For />/instance if your playback math says to get sample 171.25 out of the 
buffer, />/use .75 of sample 171 and .25 of sample 172. I don't know the math but my />/listening tests of tricky test waveforms (eg, a waveform with a 
fundamental />/at 100Hz and a 60th harmonic at 6kHz pumped up to 10, 20,30x the power, />/showed aliasing reduced by about the same amount that quadrupling the />/buffer sample rate did. />//>/I looked into other interpolations besides linear, and they didn't seem />/effective enough to bother programming. Just to give a feeling for it, if />/linear eliminated 90% of aliasing, then then more complex interpolation />/might eliminate 95%. So they might reduce it by half compared to linear, />/but only a tiny bit better compared to none at all. (The percentages are />/just meant to be illustrative and actually everything totally depends on />/your input data.) />//>/Another thing is to make sure your input data has been filtered out such />/that there's no frequencies over the Nyquist frequency. But if you're />/dealing with a PC or smart phone I'd imagine the computer hardware handles />/that for you. Once the data is in memory you cannot filter it out, as it />/will already have morphed into an alias in your input buffer and be "baked />/in" no matter how you try to play the data back. />//>/Finally, listen with good headphones; you'll hear things you probably />/won't in a room even if you have a good amp and speakers. />//>/Frank />/http://moselle-synth.com//


___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Antialias question (Kevin Chi)

2018-06-01 Thread Evan Balster
Hey, Frank —

I use four-point, third-order hermite resampling everywhere.  It's fast,
relatively simple, and as good as will be necessary for most applications.
Linear resampling can introduce some perceptible harmonic distortion into
higher frequencies.  This will be especially noticeable when slowing down
or upsampling audio with high-frequency content.

Aliasing in audio occurs when frequencies outside the representable range
are generated, by resampling, synthesis or other sources of harmonic
distortion.  Aliased frequencies "wrap around"; generating a 1700hz
frequency in a signal with 1000hz nyquist will result in a 300hz
frequency.  As a rule of thumb, when speeding up audio, you first filter
out those frequencies which will be pushed over Nyquist and wrap around;
when slowing it down, you afterward filter out those frequencies which
should not exist (but come into existence because of harmonic distortion).
I made a great improvement in a resampling-heavy soundscape application by
implementing fourth-order butterworth filters in my pitch-shifters, which
had formerly implemented no antialiasing; a great deal of "harshness" was
eliminated in one sweep.

Here is a wonderful, very skimmable paper that tells you everything you
could ever want to know about resampling and provides example code for many
techniques:  http://yehar.com/blog/wp-content/uploads/2009/08/deip.pdf

– Evan Balster
creator of imitone 

On Fri, Jun 1, 2018 at 1:03 PM, Frank Sheeran  wrote:

> Hi Kevin.
>
> I'm the least-expert guy here I'm sure, but as a fellow newbie I might
> have some newbie-level ideas for you.
>
> Just to mention something simple: linear interpolating between samples is
> a huge improvement in reducing aliasing over not interpolating.  For
> instance if your playback math says to get sample 171.25 out of the buffer,
> use .75 of sample 171 and .25 of sample 172.  I don't know the math but my
> listening tests of tricky test waveforms (eg, a waveform with a fundamental
> at 100Hz and a 60th harmonic at 6kHz pumped up to 10, 20,30x the power,
> showed aliasing reduced by about the same amount that quadrupling the
> buffer sample rate did.
>
> I looked into other interpolations besides linear, and they didn't seem
> effective enough to bother programming.  Just to give a feeling for it, if
> linear eliminated 90% of aliasing, then then more complex interpolation
> might eliminate 95%.  So they might reduce it by half compared to linear,
> but only a tiny bit better compared to none at all.  (The percentages are
> just meant to be illustrative and actually everything totally depends on
> your input data.)
>
> Another thing is to make sure your input data has been filtered out such
> that there's no frequencies over the Nyquist frequency.  But if you're
> dealing with a PC or smart phone I'd imagine the computer hardware handles
> that for you.  Once the data is in memory you cannot filter it out, as it
> will already have morphed into an alias in your input buffer and be "baked
> in" no matter how you try to play the data back.
>
> Finally, listen with good headphones; you'll hear things you probably
> won't in a room even if you have a good amp and speakers.
>
> Frank
> http://moselle-synth.com/
>
> ___
> dupswapdrop: music-dsp mailing list
> music-dsp@music.columbia.edu
> https://lists.columbia.edu/mailman/listinfo/music-dsp
>
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp

Re: [music-dsp] Antialias question (Kevin Chi)

2018-06-01 Thread Frank Sheeran
Hi Kevin.

I'm the least-expert guy here I'm sure, but as a fellow newbie I might have
some newbie-level ideas for you.

Just to mention something simple: linear interpolating between samples is a
huge improvement in reducing aliasing over not interpolating.  For instance
if your playback math says to get sample 171.25 out of the buffer, use .75
of sample 171 and .25 of sample 172.  I don't know the math but my
listening tests of tricky test waveforms (eg, a waveform with a fundamental
at 100Hz and a 60th harmonic at 6kHz pumped up to 10, 20,30x the power,
showed aliasing reduced by about the same amount that quadrupling the
buffer sample rate did.

I looked into other interpolations besides linear, and they didn't seem
effective enough to bother programming.  Just to give a feeling for it, if
linear eliminated 90% of aliasing, then then more complex interpolation
might eliminate 95%.  So they might reduce it by half compared to linear,
but only a tiny bit better compared to none at all.  (The percentages are
just meant to be illustrative and actually everything totally depends on
your input data.)

Another thing is to make sure your input data has been filtered out such
that there's no frequencies over the Nyquist frequency.  But if you're
dealing with a PC or smart phone I'd imagine the computer hardware handles
that for you.  Once the data is in memory you cannot filter it out, as it
will already have morphed into an alias in your input buffer and be "baked
in" no matter how you try to play the data back.

Finally, listen with good headphones; you'll hear things you probably won't
in a room even if you have a good amp and speakers.

Frank
http://moselle-synth.com/
___
dupswapdrop: music-dsp mailing list
music-dsp@music.columbia.edu
https://lists.columbia.edu/mailman/listinfo/music-dsp