Csound Csound-dev Csound-tekno Search About

[Csnd] chebyshev, & anti-aliasing in general

Date2007-12-13 08:04
FromTim Mortimer
Subject[Csnd] chebyshev, & anti-aliasing in general
me again : )

With all my Loris resynthesis, ATS analysis, & midi "issues", it's only
natural that a young mans heart turns back towards the possibilities of some
"basic grunt" sample playback & table based synthesis in csound...

I have always been aware however that aliasing / "flipping back over the
nyquist" is an issue with more erratic / "pointy" oscillator / table shapes,
&/or transposing samples several octaves above their actual playback ratio

& I'm also vaguely aware that chebyshev filters are something to do with a
potential solution to preventing aliasing? (as well as the assumedly related
chebyshev polynomial as a way to add harmonics to a basic sine wave in a
more classic waveshaping context...& it is this application to which the new
chebyshevpoly is mostly geared if i am not mistaken...)

but is there anyway / a best way / a "new" way to prevent aliasing on ANY
generic input signal - a "one stop anti aliasing shop" as it were?

what are the available options - for table based oscillator synthesis, (or
preventing aliasing on the new phaseshaper opcodes even - was that mentioned
as a "danger" at some point during that thread?) & also 
sample transposition / playback?

i remember one of the first discussions i ever had with Jonathon M on this
list touched on tablexkt & the sinc interpolation mode - but it was
difficult to get my head around at the time if i recall, & involved some odd
looping trick or something - anyway that was over a year ago now... i've
certainly forgotten! (My csound interests quickly went off onto PVOC once i
discovered it's prescence & relative ease of implementation....)

anyway does the new chebyshevpoly waveshaper have any potential impact (or
suggest any possible  "breakthrough") on a "anti aliasing stopper to any
signal" at all? or does such a thing already exist?

bit of a pig ignorant question i guess, but i thought with these new opcodes
(particularly Anthony Kozar if u r reading me...) it might be an opportunity
to get more familiar with potential solutions to the issue (if indeed they
do exist...) - especially if anything can be applied as a general
"preventative measure" ..... & failing this, at least understand more about
"chebyshev application" in the process

& if chebyshev has nothing to do with anti aliasing at all, i apologise
profusely for entangling the 2 issues.... 

as usual, welcome any thoughts or insight

T.
-- 
View this message in context: http://www.nabble.com/chebyshev%2C---anti-aliasing-in-general-tp14311486p14311486.html
Sent from the Csound - General mailing list archive at Nabble.com.


Date2007-12-13 10:55
FromMark Van Peteghem
Subject[Csnd] Re: chebyshev, & anti-aliasing in general
Tim Mortimer schreef:
> & I'm also vaguely aware that chebyshev filters are something to do with a
> potential solution to preventing aliasing? (as well as the assumedly related
> chebyshev polynomial as a way to add harmonics to a basic sine wave in a
> more classic waveshaping context...& it is this application to which the new
> chebyshevpoly is mostly geared if i am not mistaken...)
>   

No, the Chebyshev filter is something different, although the 
mathematics have to do with Chebyshev polynomials. See 
 for more info, 
especially the graphs that compare Butterworth and Chebyshev filters are 
interesting - it makes me feel more at ease with Butterworth filters, 
although I don't know much about the theory behind all this.

> but is there anyway / a best way / a "new" way to prevent aliasing on ANY
> generic input signal - a "one stop anti aliasing shop" as it were?
>   

I only know of the vco2 opcode, which only does some input signals, but 
works well for me. For other input signals my best guess is butterlp at 
around 10000 Hz, but there may be better ways to do it.


grtz,

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.


Date2007-12-13 11:49
From"Oeyvind Brandtsegg"
Subject[Csnd] Re: Re: chebyshev, & anti-aliasing in general
AttachmentsNone  None  

Date2007-12-13 12:38
FromMark Van Peteghem
Subject[Csnd] Re: Re: Re: chebyshev, & anti-aliasing in general
Oeyvind Brandtsegg schreef:
> I don't think a "one stop anti aliasing for any signal" method is 
> technically possible,
> because aliasing is closely related to the sampling frequency,
> and once you have a signal that contains partials higher than the 
> nyquist frequency,
> you get aliasing, and there's no way I know to remove it once it's 
> there (because the harmonics have been folded down into the frequency 
> range that the sampling rate is able to represent).

I see, you can't distinguish between folded frequencies and frequencies 
that are supposed to be there, so you can't do anything about it.

-- 
  Mark
  _________________________________________
  When you get lemons, you make lemonade.
  When you get hardware, you make software.


Date2007-12-13 13:07
FromPeiman Khosravi
Subject[Csnd] Re: Re: Re: Re: chebyshev, & anti-aliasing in general
so would the best way to do this be to filter a sample before you  
transpose it up?

Peiman

On 13 Dec 2007, at 12:38, Mark Van Peteghem wrote:

> Oeyvind Brandtsegg schreef:
>> I don't think a "one stop anti aliasing for any signal" method is  
>> technically possible,
>> because aliasing is closely related to the sampling frequency,
>> and once you have a signal that contains partials higher than the  
>> nyquist frequency,
>> you get aliasing, and there's no way I know to remove it once it's  
>> there (because the harmonics have been folded down into the  
>> frequency range that the sampling rate is able to represent).
>
> I see, you can't distinguish between folded frequencies and  
> frequencies that are supposed to be there, so you can't do anything  
> about it.
>
> -- 
>  Mark
>  _________________________________________
>  When you get lemons, you make lemonade.
>  When you get hardware, you make software.
>
>
>
> Send bugs reports to this list.
> To unsubscribe, send email sympa@lists.bath.ac.uk with body  
> "unsubscribe csound"


Date2007-12-13 14:57
From"Oeyvind Brandtsegg"
Subject[Csnd] Re: Re: Re: Re: Re: chebyshev, & anti-aliasing in general
AttachmentsNone  None  

Date2007-12-13 19:19
FromAnthony Kozar
Subject[Csnd] Re: chebyshev, & anti-aliasing in general
I think that Oeyvind and Mark are right about this, but I have a few more
comments anyways ...

Tim Mortimer wrote on 12/13/07 3:04 AM:

> & I'm also vaguely aware that chebyshev filters are something to do with a
> potential solution to preventing aliasing? (as well as the assumedly related
> chebyshev polynomial as a way to add harmonics to a basic sine wave in a
> more classic waveshaping context...& it is this application to which the new
> chebyshevpoly is mostly geared if i am not mistaken...)

Yes, chebyshevpoly is all about adding higher harmonics to the input wave
(traditionally a sine wave).  Waveshaping in general always adds harmonics
to a signal.  The property that makes the Chebyshev polynomials (CPs)
interesting is that an Nth-order CP will only add partials (to a sine wave)
up to the Nth harmonic.  So, if you carefully choose a linear combination of
CPs as your transfer function depending on the frequency of an input sine
wave, waveshaping with that CP will produce a band-limited result, allowing
you to avoid aliasing.

Non-CP transfer functions give less predictable results.  One example that I
am familiar with though is the use of a single-cycle sine wave as the
waveshaping function.  The Kurzweil K2000 synthesizer manual suggests that
this is a good way to smooth out the discontinuities produced by the extreme
distortion of their WRAP unit generator.  WRAP just multiplies a signal by a
constant but instead of clipping the results to the signal range, it "wraps"
out-of-range samples back around from positive full scale to negative full
scale.  This particular type of discontinuity is eliminated by the sine wave
waveshaper, but the higher frequencies (and some of the aliasing no doubt)
created by the distortion are not.  You can achieve the same results in
Csound by multiplying a signal and using the wrap opcode.

> what are the available options - for table based oscillator synthesis, (or
> preventing aliasing on the new phaseshaper opcodes even - was that mentioned
> as a "danger" at some point during that thread?) & also
> sample transposition / playback?

I did mention that the new phase distortion opcodes (or phaseshaping if you
like) produce non-smooth bends in the output.  These can cause aliasing but
the effect with PD is usually much more subtle because there are not large
discontinuities in the signal.  (Instead, the 1st derivative of the signal
is discontinuous).

The Wikipedia article on PD describes an interesting approach to managing
aliasing that the Casio CZ-series synthesizers used, but that is actually
related to their use of oscillator sync, not PD.  I have not tried to
emulate this technique in Csound yet, but I would like to try it.

> i remember one of the first discussions i ever had with Jonathon M on this
> list touched on tablexkt & the sinc interpolation mode - but it was
> difficult to get my head around at the time if i recall, & involved some odd
> looping trick or something

Oscillator sync is another issue altogether from waveshaping and PD.  When
implemented in a direct and "naive" way with digital signals, it definitely
produces significant aliasing.  Eli Breeder did some research on
band-limited sync and I have been interested in implementing this in Csound,
but I have not studied the math enough yet to understand the technique.

For naive osc sync, there will be a new opcode in Csound 5.08:  syncphasor.

> anyway does the new chebyshevpoly waveshaper have any potential impact (or
> suggest any possible  "breakthrough") on a "anti aliasing stopper to any
> signal" at all? or does such a thing already exist?

Nope. :)  All of these techniques are good at creating aliasing if you are
not careful, but I don't think that they can do anything to remove it once
it has happened.  (Maybe I should get a bumper sticker that says "Aliasing
happens.")

Anthony Kozar
mailing-lists-1001 AT anthonykozar DOT net
http://anthonykozar.net/