Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post Reply
User avatar
utdgrant
Posts: 540
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by utdgrant »

I noticed a strange sideband in the Pink Flight oscillator when using fast and deep PWM. This was for the Vox Numana patch in the Stringer Seventy Six Bundle. The Pink Flight code is built on the AnalogOscillator library module.

I decided to check if the CA stock Oscillator exhibited the same behaviour and it is pretty much identical in nature. The Polymode (instrument plug-in) also seems to be similarly affected.

The VM921 oscillator does not produce this strange sideband frequency, though it does tend to produce low-frequency clicks at the LFO rate.

I was just wondering if there was some reason within the AnalogOscillator module which could cause the generation of this sideband. For example, does the SetPulseWidth method only get acted on every n sample periods?

YouTube video of the effect.
______________________
Dome Music Technologies
ColinP
Posts: 951
Joined: Mon Aug 03, 2020 7:46 pm

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by ColinP »

I've never thought about what sidebands fast deep PWM might produce so don't have a clue as to whether this is some kind of defect in the AnalogOscillator stock code, but wouldn't be surprised if it is. Someone with your considerable skills should perhaps write their own oscillator.

But how much do these things matter in practice? In "the lab" they might be considered serious problems but in the context of most real-world music wouldn't such things be almost impossible to perceive? Don't get me wrong, I'm not saying that things like unwanted distortion don't matter - a bad mix can be destructive! I went to a Jack White concert a while back and couldn't believe how poor the sound quality was for instance.

Sorry if I'm sounding a bit dismissive but I often find that synth enthusiasts are overly concerned with tiny details like whether an envelope release has the right curve or some aliasing is causing friction in one track out of 16 when such concerns are pretty negligable compared to things like whether a piece of music has real emotional impact.

A comparison could be made with visual art where concerns about brush strokes and pigments might be valid at one level but what really matters is the impact a painting has on the viewer.
Steve W
Posts: 767
Joined: Thu Jul 16, 2020 5:55 pm

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by Steve W »

I can't read the numbers (Hz) where the cursors point to some of the artifact tones, but I do hear extraneous tones. I hear a low (pitch-wise) one and what sounds like a multiple of the other one being pointed to (possibly masked by true harmonics of the tone being played). Without seeing the frequencies, I can't tell if they are mathematically related to the root frequency. To my ear, it doesn't sound like it.

If its not posted, can you PM me the voltagepreset? (I recreated it with the exception of your specific settings.) Thanks.

Steve
User avatar
utdgrant
Posts: 540
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by utdgrant »

Steve W wrote: Sun Jan 08, 2023 2:15 am I can't read the numbers (Hz) where the cursors point to some of the artifact tones, but I do hear extraneous tones. I hear a low (pitch-wise) one and what sounds like a multiple of the other one being pointed to (possibly masked by true harmonics of the tone being played). Without seeing the frequencies, I can't tell if they are mathematically related to the root frequency. To my ear, it doesn't sound like it.
The low-pitched frequencies seem to be present from around 140 Hz up to about 300 Hz. The frequency generated does switch depending on the root note played, although it is not mathematically related. The weirdest aspect to me is that the frequency of the low tone seems to be the same for a group of notes played.

It may have something to do with the way Cherry Audio restrict the harmonics in the stock Oscillator module to prevent aliasing. What follows is pure speculation on my part: It may be that when you change the fundamental frequency of the CA Oscillator, it recalculates a wavetable so that harmonics above the Nyquist frequency are completely eliminated. This may also be the case whenever you change the pulse width. It may be that this recalculation isn't performed immediately but is deferred so as to improve efficiency. Without knowing exactly how CA go about creating their (fantastic !) non-aliasing oscillator output, this will just remain speculation.
If its not posted, can you PM me the voltagepreset? (I recreated it with the exception of your specific settings.) Thanks.
Sorry, I should have included it in my OP. Here you go:
PWM Zipper Noise.voltagepreset
(26.72 KiB) Downloaded 62 times
______________________
Dome Music Technologies
ColinP
Posts: 951
Joined: Mon Aug 03, 2020 7:46 pm

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by ColinP »

Even without PWM the stock oscillator pulse output exhibits some strange behaviour.

pulseTest.png
pulseTest.png (29.79 KiB) Viewed 814 times
User avatar
utdgrant
Posts: 540
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by utdgrant »

ColinP wrote: Sun Jan 08, 2023 1:17 pm Even without PWM the stock oscillator pulse output exhibits some strange behaviour.
I think that's just the Gibbs Effect, due to the fact that it's brick-wall band limited at source.
______________________
Dome Music Technologies
User avatar
utdgrant
Posts: 540
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by utdgrant »

I've made another YouTube video to illustrate what happens to the upper harmonics of the CA Stock Oscillator as they approach the Nyquist Frequency. It's clever stuff!
______________________
Dome Music Technologies
ColinP
Posts: 951
Joined: Mon Aug 03, 2020 7:46 pm

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by ColinP »

utdgrant wrote: Sun Jan 08, 2023 1:42 pm I think that's just the Gibbs Effect, due to the fact that it's brick-wall band limited at source.
AFAIK Gibbs wouldn't cause the waveform to vary between cycles. There's something going on below the fundamental - maybe some modulation attempting to give the sound an "analog feel" though I spent a lot of time looking at hardware oscillator outputs on a scope back in the 1970's and don't remember seeing anything that unstable.
User avatar
utdgrant
Posts: 540
Joined: Wed Apr 07, 2021 8:58 am
Location: Scotland
Contact:

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by utdgrant »

ColinP wrote: Sun Jan 08, 2023 5:19 pm
utdgrant wrote: Sun Jan 08, 2023 1:42 pm I think that's just the Gibbs Effect, due to the fact that it's brick-wall band limited at source.
AFAIK Gibbs wouldn't cause the waveform to vary between cycles.
The appearance of the waveform within a digital system will very much vary between cycles. This becomes especially noticeable when prominent harmonics start to approach the Nyquist Frequency.

This plot was taken from Audacity:
CASquareWaveAt48and192.png
CASquareWaveAt48and192.png (10.97 KiB) Viewed 796 times
The top trace is the output of a CA Oscillator on a 50% cycle square wave @48kHz. (Using the WAV recording output from VM). It perfectly captures the constituent sine wave components below the Nyquist Frequency, even though they look very haphazard. Any 'Visualisers' within VM can only work with these raw data points, so will look equally haphazard and inconsistent from cycle-to-cycle.

The bottom trace is exactly the same data, but resampled to 192kHz within Audacity. You can see that the constituent sine wave components are more clearly defined because there are more sample points to work with. However, there is no extra audio information in the lower plot.
There's something going on below the fundamental - maybe some modulation attempting to give the sound an "analog feel" though I spent a lot of time looking at hardware oscillator outputs on a scope back in the 1970's and don't remember seeing anything that unstable.
If you were looking at analogue waveforms on an analogue scope, then you would see something like the lower plot. This is because there is no sampling going on in between the source and the display.

Although it's completely unintuitive, if you apply a really good quality reconstruction filter to the 48kHz signal coming out of VM, you will get a consistent plot from cycle to cycle, like that shown in the lower trace.

The whole field on digital sampling is unintuitive. I watch this video on a regular basis for that reason. :)

Digital Show and Tell (Monty Montgomery @ xiph.org)
______________________
Dome Music Technologies
ColinP
Posts: 951
Joined: Mon Aug 03, 2020 7:46 pm

Re: Strange Artifact when using Fast, Deep PWM in AnalogOscillator

Post by ColinP »

Thanks for taking the time to explain Grant. Where I was going wrong was that while I was looking at a very low (sub-audio) frequency waveform I was still sampling it with too little precision and therefore seeing a visual aliasing effect.

Here's what the oscillator's pulse output looks like when viewed with greater precision...

pulseTest2.png
pulseTest2.png (6.49 KiB) Viewed 793 times

I was fooled by thinking about the absolute frequency of the signal when what really matters is the signal to sample rate ratio and in the case of the visualization the sample rate isn't 48 kHz!
Post Reply

Return to “Module Designer”