If you have a problem or need to report a bug please email : support@dsprobotics.com
There are 3 sections to this support area:
DOWNLOADS: access to product manuals, support files and drivers
HELP & INFORMATION: tutorials and example files for learning or finding premade modules for your projects
USER FORUMS: meet with other users and exchange ideas, you can also get help and assistance here
Help and advice needed: Aliasing oscillators
8 posts
• Page 1 of 1
Help and advice needed: Aliasing oscillators
Guys, I could do with a little bit of help and advice with aliasing issues.
I was inspired by tulamide’s interest in the idea of a vector oscillator. I knocked up a basic idea and experimented, but realised I knew little about aliasing, which is a big problem for my oscillator (attached in a test synth).
I’ve learnt that since any frequencybased ramp will have different values throughout, depending on the frequency produced, and this causes bad jitter for any levelbased action within the DSP process, as well as producing frequencies above nyquist.
I imagine that musical pitches do not relate directly to the sample rate in a nice wholesome way so the artefacts vary with pitch considerably. I can hear dreadful changes by holding a high note and adjusting the finetune very carefully. I also hear this and see it with a naïve ramp so I don’t think it’s purely down to my code.
I’ve looked into BLEP and BLIT techniques and it seems this only works when you know where the fast transitions will occur (square and saw waves). I’ve read about PTRs and EPTRs but I know nothing about how to implement such things, and indeed if they would work with any procedural arbitrary oscillator like mine.
Is it possible to add a block of DSP code before the signal is output to remove the crap? Or does the processing have to be within the steps of each action?
I made a smoothing module using 6 x 1sample delays for averaging (included in the test synth) and it does make the transitions less steep but it doesn’t get rid of the horrible jitter which is happening in the DSP code.
The oscillator in the test synth is by no means final but I need to address the artefact issue before I try to progress further. At the moment I could use something like this osc in a bass synth but not much more.
If anyone could offer any input (that I could understand and use!) I’d really appreciate it very much.
(I never had these problems with opamps you know )
Cheers
Spogg
I was inspired by tulamide’s interest in the idea of a vector oscillator. I knocked up a basic idea and experimented, but realised I knew little about aliasing, which is a big problem for my oscillator (attached in a test synth).
I’ve learnt that since any frequencybased ramp will have different values throughout, depending on the frequency produced, and this causes bad jitter for any levelbased action within the DSP process, as well as producing frequencies above nyquist.
I imagine that musical pitches do not relate directly to the sample rate in a nice wholesome way so the artefacts vary with pitch considerably. I can hear dreadful changes by holding a high note and adjusting the finetune very carefully. I also hear this and see it with a naïve ramp so I don’t think it’s purely down to my code.
I’ve looked into BLEP and BLIT techniques and it seems this only works when you know where the fast transitions will occur (square and saw waves). I’ve read about PTRs and EPTRs but I know nothing about how to implement such things, and indeed if they would work with any procedural arbitrary oscillator like mine.
Is it possible to add a block of DSP code before the signal is output to remove the crap? Or does the processing have to be within the steps of each action?
I made a smoothing module using 6 x 1sample delays for averaging (included in the test synth) and it does make the transitions less steep but it doesn’t get rid of the horrible jitter which is happening in the DSP code.
The oscillator in the test synth is by no means final but I need to address the artefact issue before I try to progress further. At the moment I could use something like this osc in a bass synth but not much more.
If anyone could offer any input (that I could understand and use!) I’d really appreciate it very much.
(I never had these problems with opamps you know )
Cheers
Spogg
 Attachments

 Quilcom Vectorious tests dev 14 aliasing.fsm
 Don't bother with this unless you're interested in the problem! It sounds crap ATM.
 (1.2 MiB) Downloaded 417 times

Spogg  Posts: 2450
 Joined: Thu Nov 20, 2014 4:24 pm
 Location: Birmingham, England
Re: Help and advice needed: Aliasing oscillators
Hey Spogg, your oscillator is made of (4) linear segments with 4 kinks and a discontinuity per cycle, hence the aliasing. I have replaced the kinks by approprialtely scaled parabola oscillators, and added sawtooth for the discontinuity. Fortunately we have alias suppressed oscs for these waveforms. As a bonus the resulting wave is DC free. It does have a higher CPU hit though...
 Attachments

 Quilcom Vectorious tests dev 14 alias_suppressed.fsm
 (236.63 KiB) Downloaded 412 times

martinvicanek  Posts: 1017
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Help and advice needed: Aliasing oscillators
Martin, as ever you amaze me! I can’t even imagine how you came up with that so damn fast
The output sounds really clean now, all the way up the keyboard, and this really impresses me.
I’ve tried to work out how this works. I know it makes use of preantialiased oscillators which is a great place to start. What I haven’t got to yet is an understanding of how these oscillators, with their simply summed wholecycle outputs, can produce the varying rampbased shapes defined by the level and time values. I suspect there is some cunning maths involved in adding or subtracting the parabola shapes. Also I have no idea why we need the single saw as well.
I would love to hear some sort of explanation but please be aware it might be as effective as trying to explain quantum mechanics to a frog . In the meantime I will experiment with what you did to try and work out for myself what’s happening.
As a side issue I’m not convinced that the sounds produced will be musically useful or interesting but that’s another matter. What I originally had as a goal was to have the start (and end) value fixed at zero so I could just vary and modulate the intermediate levels and time points, and also to have more than 4 stages. In addition changing the level and time for each kink should only affect the ramps leading to and from the point adjusted. I’ve no idea if that’s even achievable but I can see it in my mind.
Again, thank you so much for doing this.
Cheers
Spogg
The output sounds really clean now, all the way up the keyboard, and this really impresses me.
I’ve tried to work out how this works. I know it makes use of preantialiased oscillators which is a great place to start. What I haven’t got to yet is an understanding of how these oscillators, with their simply summed wholecycle outputs, can produce the varying rampbased shapes defined by the level and time values. I suspect there is some cunning maths involved in adding or subtracting the parabola shapes. Also I have no idea why we need the single saw as well.
I would love to hear some sort of explanation but please be aware it might be as effective as trying to explain quantum mechanics to a frog . In the meantime I will experiment with what you did to try and work out for myself what’s happening.
As a side issue I’m not convinced that the sounds produced will be musically useful or interesting but that’s another matter. What I originally had as a goal was to have the start (and end) value fixed at zero so I could just vary and modulate the intermediate levels and time points, and also to have more than 4 stages. In addition changing the level and time for each kink should only affect the ramps leading to and from the point adjusted. I’ve no idea if that’s even achievable but I can see it in my mind.
Again, thank you so much for doing this.
Cheers
Spogg

Spogg  Posts: 2450
 Joined: Thu Nov 20, 2014 4:24 pm
 Location: Birmingham, England
Re: Help and advice needed: Aliasing oscillators
Update: I removed the saw and found the whole thing worked like I originally envisioned! Out of interest I added level controls for the saw and the parabolas, in order to see the effect, and it’s really interesting. I can change the curviness of the sections now and introduce a variable amount of high frequencies with the ramp level.
For anyone interested here’s the schematic with the extra level controls. With all the parabola levels set the same (say half way) you get the same wave shape, just the amplitude is reduced.
I don’t yet know if the result is very useful but it’s been fascinating for me so far. I’m wondering if it’s possible to have more sections now…
Cheers
Spogg
For anyone interested here’s the schematic with the extra level controls. With all the parabola levels set the same (say half way) you get the same wave shape, just the amplitude is reduced.
I don’t yet know if the result is very useful but it’s been fascinating for me so far. I’m wondering if it’s possible to have more sections now…
Cheers
Spogg
 Attachments

 Quilcom Vectorious tests dev 16 MValias_suppressed, levels for ramp and 4 parabolas .fsm
 (1.39 MiB) Downloaded 408 times

Spogg  Posts: 2450
 Joined: Thu Nov 20, 2014 4:24 pm
 Location: Birmingham, England
Re: Help and advice needed: Aliasing oscillators
About aliasing: Think of a perfect saw, which has frequencies all the way up to infinity. When you sample a perfect saw, frequencies above Nyquist will fold back into the audible band where they appear as disturbing, inharmonic artifacts.Some partials may even end up below the fundamental, and that's where it gets really bad. Either way, once aliasing occurs it will stay, no matter how much filtering you apply. So the trick is to avoid it in the first place.
How? Well, think of it as filtering before you actually sample the waveform. So a filtered saw will be modified at the discontinuity (in what way exactly is a bit involved), however the important thing is that you do it before the sampling. That's why you need to account for where exactly it happens between two samples. That's how BLEP works anyway.
There is tons of stuff on alias suppression on the Web, google it before the man with the red hair shuts down the internet.
How? Well, think of it as filtering before you actually sample the waveform. So a filtered saw will be modified at the discontinuity (in what way exactly is a bit involved), however the important thing is that you do it before the sampling. That's why you need to account for where exactly it happens between two samples. That's how BLEP works anyway.
There is tons of stuff on alias suppression on the Web, google it before the man with the red hair shuts down the internet.

martinvicanek  Posts: 1017
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Help and advice needed: Aliasing oscillators
Thanks Martin! I understand that bit now I think.
For my next lesson may I ask just how you get those 4 linear ramps by mixing 4 curvy parabolas together? I do hope it's not magical in nature although to me it seems like it might be.
Plus, in the "driver" module that controls the parabola oscillators I see values of 2.1 and 0.166667 are involved. Knowing your work I bet these are calculated, or are they empirical? If you can't explain simply then hit me with the maths and even if I don't get it somebody else may benefit.
You see I would never in a million years have thought of adding parabolae together to produce linear output. The only way I could think of doing it was my original idea of a kind of integrator based on an accumulator.
If you do use some of your most precious time responding to this I will be exceedingly grateful Martin.
Cheers
Spogg
For my next lesson may I ask just how you get those 4 linear ramps by mixing 4 curvy parabolas together? I do hope it's not magical in nature although to me it seems like it might be.
Plus, in the "driver" module that controls the parabola oscillators I see values of 2.1 and 0.166667 are involved. Knowing your work I bet these are calculated, or are they empirical? If you can't explain simply then hit me with the maths and even if I don't get it somebody else may benefit.
You see I would never in a million years have thought of adding parabolae together to produce linear output. The only way I could think of doing it was my original idea of a kind of integrator based on an accumulator.
If you do use some of your most precious time responding to this I will be exceedingly grateful Martin.
Cheers
Spogg

Spogg  Posts: 2450
 Joined: Thu Nov 20, 2014 4:24 pm
 Location: Birmingham, England
Re: Help and advice needed: Aliasing oscillators
Yes, it may be surprising how a combination of curves results in straight line segments. Let me explain how the curvature gets ironed out:
Note that each parabola enters with a weight according to the corresponding kink strength of the piecewise linear waveform that we are seeking to model. Here kink strength is simply right slope minus left slope.
Observe that over one cycle, the kink strengths add to zero. (Since the wave form is periodic, after one cycle you end up with the same slope as where you started.)
Now each parabola has the same curvature everywhere (except at the kink). Because the weights add to zero, the resulting curvature is zero (except at the kinks). What remains is a piecewise linear waveform.
Magic demystified?
As to the constants: A normalized parabola segment is given by
y = 1  6x + 6x^2,
where x denotes the phase. The scale parameter 0.1666 = 1/6 enters because the (left) slope at the kink is 6. And the phase shift 0.21 = 0.5  1/sqrt(12) represents the first zero crossing. Since I start my oscillators at zero (to avoid clicks), I have to compensate this pahse shift to get the kink locations right.
Easier than quantum mechanics.
Note that each parabola enters with a weight according to the corresponding kink strength of the piecewise linear waveform that we are seeking to model. Here kink strength is simply right slope minus left slope.
Observe that over one cycle, the kink strengths add to zero. (Since the wave form is periodic, after one cycle you end up with the same slope as where you started.)
Now each parabola has the same curvature everywhere (except at the kink). Because the weights add to zero, the resulting curvature is zero (except at the kinks). What remains is a piecewise linear waveform.
Magic demystified?
As to the constants: A normalized parabola segment is given by
y = 1  6x + 6x^2,
where x denotes the phase. The scale parameter 0.1666 = 1/6 enters because the (left) slope at the kink is 6. And the phase shift 0.21 = 0.5  1/sqrt(12) represents the first zero crossing. Since I start my oscillators at zero (to avoid clicks), I have to compensate this pahse shift to get the kink locations right.
Easier than quantum mechanics.

martinvicanek  Posts: 1017
 Joined: Sat Jun 22, 2013 8:28 pm
Re: Help and advice needed: Aliasing oscillators
Thanks for that Martin. I kind of sort of get it but I think I need to be tulamide to understand it properly! In which case I shall assume that magic is involved and just accept it and move on. Like a frog accepts its frogness.
I do appreciate your work on this very much.
Cheers
Spogg
I do appreciate your work on this very much.
Cheers
Spogg

Spogg  Posts: 2450
 Joined: Thu Nov 20, 2014 4:24 pm
 Location: Birmingham, England
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: Google [Bot] and 2 guests