# Building a simple oscillator using a mixer - why no apparent aliasing?

About one year ago I had fun experimenting with no input mixing using a Mackie mixer. All the sounds are the result of feedback, and you can get some really interesting results.

So I was curious if I could do something remotely similar with VCV Rack - could I create an oscillator using a mixer and feedback? I managed to create both triangle and sawtooth wave forms by adding a comparator and a switch or VCA. I was expecting such a crude oscillator to have pronounced aliasing. But much to my surprise, I didnāt see or hear any! After some experimentation, I determined that the harmonic reflections around the Nyquist frequency are actually there, but for some unknown reason the oscillator frequency is always an integral division of the Nyquist frequency, so the reflections reinforce other lower frequency harmonics and are not apparent.

I created a video that demonstrates how I created the oscillators, and the puzzling behavior. I would be forever grateful if someone could explain why my crude oscillator frequencies are constrained to integral divisions of the Nyquist frequency.

Here is the patch: mixer oscillator.vcv (20.2 KB)

I used the Vult Knobs as my mixer, but the specific module doesnāt seem to matter. I didnāt show it, but I got the exact same behavior using a combination of the VCV Mixer and 8VERT.

Thanks

7 Likes

@Squinky.Labs I believe this is right up your alley sir!

In a digital synthesizer, using feedback loops to create oscillating signals will usually lock the frequency to divisions of the sample rate, f = f_{sr}/n. This is because the oscillator will reset its phase on exact digital sample frames rather than subframes like an analog modeling oscillator.

Some aliasing should exist, but it is reduced. Hereās my guess.

If you bandlimit any analog signal, subtract it from the original analog signal, and digitally sample the result, you get the digital āerrorā signal. If your analog signal has frequency f=f_{sr}/n, then its harmonics have frequencies f_{sr}/n*m. If your signal resets phase on exact digital sample frames, then each harmonic will not contribute to the digital error if f_{sr}/n*m is a factor of f_{sr}/2, or in other words, if 2m/n is an integer. This means that aliasing (digital sampling of supersonic harmonics) is reduced when your oscillatorās phase resets on digital sample frames.

8 Likes

Thanks for responding.

Iām not seeing how the triangle resets its phase, but the saw wave kind of resets because it always cuts off all voltage sources for enough samples to get the entire circuit back to 0 volts once every cycle. But either way, time is effectively quantized by the sample rate, and I can see how the oscillator wave length would always be an integral number of samples. The comparator always tests at an integral number of samples, and at some integral point the oscillator either resets to 0 or begins ācountingā in reverse. And I can see how a model based oscillator does not have the same constraint.

But I still struggle to see why the frequency should be constrained to Fsr/N. It seems like a wavelength of any integral number of samples should be possible. Certainly not all integral counts of sample cycles are evenly divisible into the sample rate. What am I not seeing?

Is the aliasing really reduced in my case? Take the 1st harmonic that exceeds the Nyquist frequency. Since the fundamental frequency is an integral division of the Nyquist frequency (for reasons I still donāt understand), the reflected harmonic is superimposed on the first harmonic below the threshold - increasing the intensity of that harmonic. It seems to me the aliasing is still occurring at 100%, but it is simply masked by superposition of other harmonics.

Again, is there something I am missing? Or do I not understand your math and we are effectively saying the same thing?

Iām certainly out of my league. I feel like I have some high level understanding of some of the DSP concepts, probably with some misconceptions to go along with that understanding. So please donāt let my ignorance irritate you!

The one thread where you WANT him to chip in about aliasing and heās nowhere to be foundā¦

3 Likes

"wavelength of integral number of samples n" implies f = f_{sr} / n for n\geq 2.

1 Like

They sure areā¦ imagine the shortest wavelength (2 samples)ā¦ thatās exactly half of Nyquistā¦ consider the second shortest (3 samples), thatās exactly a third of Nyquist, and so onā¦

To go down the road of musical feedback you probably need high quality interpolators, that estimates values between the samplesā¦ Iām sure a high-quality delay module would support this.

(Tap-Dancer sure would, but does not support super-short delay-times, so I would not suggest thatā¦)

1 Like

Thanks Jonas and @Vortico for helping me understand what now seems obvious.

I was thinking about the relationships in reverse, in a totally bass-ackwards, nonsensical way - trying to divide the wavelength into the Nyquist frequency ā¦ donā ask

haha - oh, Iām around. Just not as often since I donāt have to āmarketā free modules any more. But it seems itās all been covered. If the period of the āvcoā is in integral number of samples, then yes there there is not obvious aliasing. I think actually there is some but itās at the harmonic frequencies so itās not objectionable. I actually discuss that case in my doc about aliasing: Demo/aliasing2.md at main Ā· squinkylabs/Demo Ā· GitHub.

But, I sure wouldnāt have figured out the key here - that the VCO is limited to to integer periods.

cool stuff!

because we have integer samples we have reflected alias frequencies that are exactly reflected on top of the correct harmonics

this means we have not a classic dissonant distortion, but a boost on the high harmonics

still a distortion but filterable via correct LP curve

1 Like