Additive VCO with Arduino (Hagiwo)

[ $6 ] DIY modular synth Additive VCO with arduino mozzi / additive synthesis for ambient music

Additive VCO , total 8 sine wave synthesis with mozzi library.
It can produce sounds like a pipe organ, metallic sounds, and floating sounds with virtual pitch.

Infos, code … here :

https://note.com/solder_state/n/n30b3a8737b1e

8 Likes

Awesome stuff again!! I wonder where to get Arduino Nanos for 2$! I bought 3 more last week and they were more like 6 or 7€ each… I bought a few half a year ago and they did only cost half as much back then.

3 Likes

I bought arduino on aliexpress.
The quality is not good, the shipping is slow, the packaging is sloppy, and often I get something different from the picture, but it works fine.

Recently, it seems that the price has risen due to a shortage of semiconductors.

3 Likes

I notice in this schematic the pulldown resistor on the V/oct input has been moved to before the series resistor, but not on the other two CV inputs. Since those aren’t V/oct the resulting 1% voltage drop is not critical but I’d still put the pulldowns on the other side of the series resistor on those inputs too.

1 Like

I have a liitle problem with this build.

All works fine except when i plug a CV source in 1V/oct input jack.

there some little “clic” or “cric” on the sound (and for an ambiant module sound is not good at all :unamused:)

I tried differents CV source but allways the same “clic”

an idea someone ?

i precise that mine is build with a TL071

I think that the problem is with the Mozzi library. When an oscillators frequency is changed, it changes immediately. Or to be precise, the “phase increment fractional” of phasor changes. With a sinewave without any harmonics it generates a small corner with harmonics, which is probably usually almost inaudible, but here we have stacked 8 sinewaves on top of each other, and all of them have that corner at the same time, so it’s much more audible.
Or that’s what I think about the reason.
Solutions would need changes in the code. Easiest I can think of would be to implement some kind of slew rate to the change in the frequency. Depending on how often the updateControl() function is called, it could instead of immediately saving the new frequency just to add a small change to the previous until it matches the new, changing the frequencies of the oscillator every time, but with much smaller changes. Or if this doesn’t use too much processing power, it could be done in the updateAudio() function with even finer resolution. If it is the case, that any change in frequency with sine wave produces an audible click, these of course don’t help.
Also, if changing frequency of only one harmonic doesn’t produce audible click, they could be staged such as they don’t change at the same time, but for example few milliseconds apart.

2 Likes

thx @Krakenpine

I just tested with the “Chord” code and the CV works fine, so I think it is not my circuit.

what is strange is that the click is regular like a timer, and not necessarily when it changes note …

and also @HAGIWO don’t seems to have this problem in his vid

1 Like

Well I tried the code for the “FM” and no problem either.
I really liked the “Additive”, but I really didn’t want to bother with it.
A little paint on the panel and hop on the FM instead !

goodbye Additive :disappointed:, hello FM :slight_smile:

4 Likes

Metamorphose :slight_smile:

6 Likes

I build this finally, and I think that the popping sound was either not setting this to hifi -mode or some weird glitch. I managed to get it much worse by putting some division calculations to the audio output -part. They are really slow on 8-bit processors.
Anyway, then I changed all the code and all the electronics to have it much less jumpy and make this actually a full synth voice with ADSR-envelope. And as the v/oct -input is quite stepped, to have adjustable “slew rate” or portamento to use in ambient stuff.
It’s actually quite challenging to program this with 8-bit processor that really doesn’t have much processing power as you want to maximize sound quality. Floating point numbers are slow, but using integers quickly loses information when dividing. And dividing is so costly anyway, so you want to replace that with bit shifts, so only divisions by powers of 2. And if you do multiplications and divisions in the wrong order, you have interger overflows.
A nice change of thinking from my real jobs way of “code is getting slow, let’s throw more money to the cloud service provider to have more power”.

5 Likes

I remember learning about fractional fixed point arithmetic when I first encountered DSPs back in the day. Does ones head in, but quite powerful stuff with limited compute resources.

That said, dibs on the first “cloud capable” distributed eurorack module, I’m sure the hipsters would dig it.

Cheers

2 Likes

“fractional fixed point arithmetic”, yea, I know about this from NES-programming stuff. Usually in context of sub-pixel positions.

3 Likes

In an audio context, where things are bounded by [-1,1] fixed point is pretty good for doing resonant IIR filters, because by assuming that the integer portion is 0, you can more or less guarantee that the filter is going to be stable, as every multiplication is guaranteed to have a result < 1.

1 Like

Yes, floating point arithmetic can be highly accelerated in processors like Intel 80386 (1985) and onwards but even now it’s common for embedded chips, microcontrollers and whatnot, to support only fixed point arithmetic in hardware, to keep the transistor count low enough for high quality control and thus cheaper production runs.

In the late 1960s a guy called Charles Moore pioneered a unique style of programming that came to be known after his most successful version: Forth. He’s still around and his minimalist language family Forth is one example of a programming system that still gives priority to fixed point arithmetic. Forth doesn’t make you ditch floating point, but it does host many excellent alternatives that enable you to find a solution using fixed point arithmetic.

Here’s an example from the Forth standard in which a crucially important arithmetic operator is defined. This produces a temporary double-precision integer multiplication result which is then divided by a single-precision integer to produce a single-precision result. This enables the programmer to arrange an appropriate scale to the result and maximize its precision. If the same operation is performed by an integer multiplication followed by an integer division, without expanding precision for the intermediate result, the result is lost precision (floating point is another way to maximize precision but this method can work better and potentially much faster if the coder is well trained.)

https://forth-standard.org/standard/core/TimesDiv


Here’s currently how this completely rewritten and reimaged additive oscillator sounds now. ADSR is internal and first output is raw from this module, then with the triple splashback delay. Lot to improve, but this can become a nice pseudo-organ -type thing. Squeezing polyphony out of one Arduino Nano may be a bit though one, but what if I design a pcb that can be stacked with smaller ones to get more voices…
Stupid, unpractical and so funny that I probably must.
But I don’t have polyphonic midi-to-cv. Will the midimuso-module ever be available again, or do I just need to make my own.

4 Likes

Hi,
Sorry about the resurrection of this mummified post, but this module looks too good to miss out.
I don’t have any experience with building modules without a PCB and a BOM, so could anyone please assist me with the following:

  1. What components do I need? (I can sort of make out the schematics, but I wouldn’t know the specific parts e.g. what min. voltage for the capacitors)

  2. If we’re not using PCBs for this build, how do I know what connects to what and how?

  3. How do I go about uploading the code to Arduino, never dealt with that. (and while we’re at it, @Krakenpine , would you please be willing to share your improved code?)

  4. Any additional help that you guys are willing to provide would be most appreciated.

Thanks!

That’s not really improved code, it’s completely different thing: GitHub - Krakenpine/Harmoniqs: 4-voice additive harmonics oscillator with Arduino Nano

It goes so close to the limits of the Arduino Nano, that position of the planets affects if that can actually have four voices without glitching. It probably has something to do with the midi input, some midi controllers give out more data, like midi clock and/or aftertouch, which aren’t used, but the midi commands in the queue still need to be inspected.

4 Likes

Thank you for replying.
I’m not a coder, but I would love to build a module just like the additive VCO only less noisy and with far more partials. How complicated would that be? I imagine I will need a more robust board but other than that I wouldn’t even know where to start. Where do I start?

Depends a bit about things. Like what you mean by “less noisy”? With Arduino Nano you cannot really have high enough sample rates to have any hifi sound, and they are internally 8 bit and even with the Mozzi-library “hifi”-hack of using two PWM-outputs combined, the output result is about 12-14 bits in quality. Sample rate dictates how high frequencies you can have, Nyquist frequency is the maximum which is half of the sample rate. So you have to filter out all frequencies above that as there isn’t any meaningful information there, and PWM itself needs to be properly filtered. Bit depth, even if it seems strange, basically only defines the amount of noise in the signal. I personally challenge that interpretation, as the noise that comes from the bit depth changes with the signal, so it could be also thought as a distortion. The engineer and signal theorist in me are battling. I feed the engineer more.

More “partials”, or with additive VCO you probably mean harmonics? The limited sample rate of Arduino Nano -based stuff also limits that, but having lot’s of harmonics doesn’t really change the sound that much after certain amount. I’ve been happy with eight.

Maybe I could tackle this project again, by making it monophonic and not having that “complete synth voice”-mentality, so the output can always be at maximum, using most of the limited bit depth and thus maximizing sound quality.

Much more complicated version of that is already in progress with Daisy, so maybe Arduinos for the simpler stuff is the better way: GitHub - Krakenpine/Daisy-Harmoniqs: Additive harmonics synth for Daisy platform

3 Likes

Hi again @Krakenpine , thanks for writing back.
I’ll try to be more clear this time. By ‘noise’ I meant the quantization noise the I imagine stems from the hardware’s low bit depth. As for the number of partials (or harmonics) , I noticed that if I tune the fundamental to about 30hz, I can hear up to around the 400th harmonic, so around that would be ideal, at least to my ears. I do like the simplicity of this module but maybe the sound can be dramatically augmented. (I’m thinking: a DIYer’s Xaoc Odessa)

Also, personally having multiple voices is not a concern.