FAQ & Terms of UseFAQ & Terms Of Use   Wiggler RadioMW Radio   Muff Wiggler TwitterTwitter   Support the site @ PatreonPatreon 
 SearchSearch   RegisterSign up   Log inLog in 

Show me your square wave! Perfect analog emulation?
MUFF WIGGLER Forum Index -> Music Software  
Author Show me your square wave! Perfect analog emulation?
I was programming a square wave generator and it sounded like crap. I took a look at the spectrum in Audacity and there were many frequencies below the intended frequency and a lot of digital noise. I won't show you my generator, it is just too awful, but here is an example of the Fundamental module VCO-1 in VCV Rack, which has a similar problem:

That's with 44.1 kHz samplerate, generating a square wave of 2503 Hz.

And this is how it looks like when I create it with the "Generate->Tone->Square, no alias" function:

Ok, the noise is below -50 dBFS, so you would think maybe not a big deal, right? This is how it sounds:

Please tell me which one is the VCV Rack version and which one is the Audacity one. So much for my idea that -50 dBFS doesn't matter much Dead Banana

This is the source code in Audacity: pp#L214

It needs a lot of computing resources, up to 200 sin/cos calculations per sample. Wouldn't be that much of a problem with modern hardware, but I guess I can't use it for a VCO, because I want to modulate the frequency, and the duty cycle as well.

So what is the best state-of-the-art square wave VCO, where duty cycle and frequency can be modulated in real time? Doesn't matter how much calculation it needs. But would be nice, if the algorithm is open source.

And how does the spectrum of your favorite square wave generator look like, and how does it sound? Any comparisons of real analog generators? Modules? Let's make a list of Audacity spectrum plots for all Eurorack square wave generator modules at the same frequency of 2503 Hz!
Ok, I tested some more modules in VCV Rack. The Fundamental VCO was bad, next one is VCO-F! from Gratrix:

Maybe a little bit better than the VCO from the Fundamental set, but still far from perfect and you can hear the distortions.

But look at "Voltage Controlled Oscillator" from Lindenberg Research:

There is no noise and I can't hear aliasing effects. Only problem is that it isn't a square wave and sounds different, but not bad. Edit: It is the best square wave oscillator, see next posting.

I tried a few others from the free modules of VCV Rack and most are worse. But VCO from Bogaudio looks not that bad, the distortions are below -70 db, and it sounds like a nice square wave. The harmonics look good as well, except for a strange spike at 16400 Hz, but I don't hear this anyway:

Finally I found a nearly perfect square wave oscillator: "EvenVCO" from Befacto. The spectrum has no noise and looks like a square wave spectrum and it sounds good. Only a few minor spikes below -78 dB, but I don't hear them:

This is the source code:

It uses the MinBLEP class from the dsp directory and it is open source software. I found more information about MinBLEP here:

Duty cycle and frequency can be adjusted in real time as well. So unless someone finds the perfect oscillator which creates the spectrum of the Audacity generator, I think I will take a closer look at this for my oscillators.
Correction: I think I must have used the duty cycle knob for the "Voltage Controlled Oscillator" from Lindenberg Research. It is a perfect oscillator:

But needs more computing resources than the EvenVCO oscillator. This is the source code of the algorithm: llator.cpp
Remember that there are hardly any true analogue VCOs that make a for pure square wave. Almost all have over-ring (ringing at the transitions) and many don't have flat tops either. There are many VCOs that don't do the true wave shapes. Once you get a oscilloscope you see this.
That's right, all analog signals are bandwidth limited as well. The difference is that alias distortions sound much more "dirty" and unpleasant than any bandwidth limitation, at least for me.
This is very interesting, one day I would like to do some software for VCV and I had no idea. Thank you for taking the time to share your findings.
MUFF WIGGLER Forum Index -> Music Software  
Page 1 of 1
Powered by phpBB © phpBB Group