[Csnd-dev] Aliasing Issue
Date | 2015-10-20 12:50 |
From | Peter Burgess |
Subject | [Csnd-dev] Aliasing Issue |
Attachments | Anti-Aliasing Example.csd |
I seem to have an issue with aliasing that I can't get rid of, at least, it sounds like aliasing. I'm currently working at 96 kHz sample rate, and I am passing a square wave oscillator through 4 x 80 pole butterworth filters at 20 kHz. The filters make no notable difference to the aliasing. I have tried changing the sample rate, the ksmps and the cut-off frequency and the of the filters and the buffer sizes to see if any of them make a difference. The interesting thing is that if I reduce the cut-off into the audio range, it filters both the un-aliased and aliased frequencies as if the aliased frequencies are already added to the signal before it reaches the filter.Incase it makes a difference, I am running csound 6.05 on Ubuntu, and I have tried running my .csd both in csoundQt and the terminal. I have attached an example .csd to show what I mean. |
Date | 2015-10-20 13:32 |
From | Richard Dobson |
Subject | Re: [Csnd-dev] Aliasing Issue |
The square wave itself is constructed using plain line segments, and for that reason isn't bandlimited (in such cases, not slightly but massively) - it is already aliasing, and filters can't do anything about that. Try vco or vco2 to create a bandlimited signal. In digital audio, we can't really have any waveform with corners, abrupt instantaneous changes, or "literally" straight lines. We sort of get away with it with piece-wise amplitude envelopes, most of the time, but not for audio rate oscillators. Richard Dobson On 20/10/2015 12:50, Peter Burgess wrote: > I seem to have an issue with aliasing that I can't get rid of, at least, > it sounds like aliasing. I'm currently working at 96 kHz sample rate, > and I am passing a square wave oscillator through 4 x 80 pole > butterworth filters at 20 kHz. The filters make no notable difference to > the aliasing. > > I have tried changing the sample rate, the ksmps and the cut-off > frequency and the of the filters and the buffer sizes to see if any of > them make a difference. The interesting thing is that if I reduce the > cut-off into the audio range, it filters both the un-aliased and aliased > frequencies as if the aliased frequencies are already added to the > signal before it reaches the filter. > > Incase it makes a difference, I am running csound 6.05 on Ubuntu, and I > have tried running my .csd both in csoundQt and the terminal. I have > attached an example .csd to show what I mean. > |
Date | 2015-10-20 13:37 |
From | jpff |
Subject | Re: [Csnd-dev] Aliasing Issue |
Two comments 1: oscili is more prone to errors than poscili or oscil3 etc 2: your squarewave has al the aliases in it already. Needs to be band limited Now over to the experts.... On Tue, 20 Oct 2015, Peter Burgess wrote: > I seem to have an issue with aliasing that I can't get rid of, at least, it > sounds like aliasing. I'm currently working at 96 kHz sample rate, and I am > passing a square wave oscillator through 4 x 80 pole butterworth filters at 20 > kHz. The filters make no notable difference to the aliasing. > > I have tried changing the sample rate, the ksmps and the cut-off frequency and > the of the filters and the buffer sizes to see if any of them make a > difference. The interesting thing is that if I reduce the cut-off into the > audio range, it filters both the un-aliased and aliased frequencies as if the > aliased frequencies are already added to the signal before it reaches the > filter. > > Incase it makes a difference, I am running csound 6.05 on Ubuntu, and I have > tried running my .csd both in csoundQt and the terminal. I have attached an > example .csd to show what I mean. > > Pete > |
Date | 2015-10-20 13:40 |
From | Victor Lazzarini |
Subject | Re: [Csnd-dev] Aliasing Issue |
After you generate an aliased signal, it is unlikely that you can fix it with a filter. You need to generate a bandlimited or alias-suppressed signal to start with. ======================== Dr Victor Lazzarini Dean of Arts, Celtic Studies and Philosophy, Maynooth University, Maynooth, Co Kildare, Ireland Tel: 00 353 7086936 Fax: 00 353 1 7086952 > On 20 Oct 2015, at 12:50, Peter Burgess |
Date | 2015-10-20 14:10 |
From | Peter Burgess |
Subject | Re: [Csnd-dev] Aliasing Issue |
That's interesting. I was thinking that the aliasing should be removable right up until the signal gets output. Thinking about it now, that wouldn't make sense as it's the reading of the discrete samples that causes the aliasing... Thanks for straightening me out here! I want a reasonable level of control over the initial waveshape, so i guess I best just be careful with my function tables. I can use a smaller table size for square waves.I have just been reading through the vco2 opcodes, and I see that you can use user-defined tables as-well (using vco2init). vco2 is band limited when using the built in tables, but will this still be the case when using user-defined tables? I'm hazarding a guess that it won't, that would be too easy :D On Tue, Oct 20, 2015 at 1:32 PM, Richard Dobson <richarddobson@blueyonder.co.uk> wrote: The square wave itself is constructed using plain line segments, and for that reason isn't bandlimited (in such cases, not slightly but massively) - it is already aliasing, and filters can't do anything about that. Try vco or vco2 to create a bandlimited signal. In digital audio, we can't really have any waveform with corners, abrupt instantaneous changes, or "literally" straight lines. We sort of get away with it with piece-wise amplitude envelopes, most of the time, but not for audio rate oscillators. |
Date | 2015-10-20 15:22 |
From | Peter Burgess |
Subject | Re: [Csnd-dev] Aliasing Issue |
Attachments | Anti-Aliasing Example.csd |
I'm sure people have done things like this before, but I have come up with a simple and effective example of how to remove aliasing partials from the a waveform played at any frequency. I have attached this example bellow. My example plays the aliased square wave first, then the anti-aliased version.To remove the aliasing frequencies, I calculate the nyquist frequency from the sr, and then with each note played, calculate the max partial number allowed for that note. I then use GEN 30 to retrieve the allowed partials from my alias-ridden sqaure waveform. It is loosely based on what I found in the manual for GEN 30, but I'm not entirely sure that the GEN 30 example is meant to demonstrate the same usage as my example, but if it is, it seems quite convoluted. On Tue, Oct 20, 2015 at 2:10 PM, Peter Burgess <pete.soundtechnician@gmail.com> wrote:
|
Date | 2015-10-20 17:16 |
From | Peter Burgess |
Subject | Re: [Csnd-dev] Aliasing Issue |
Oh, one minor adjustment, the gen30 function needs a much bigger table number to properly prove that it works |