Saturday, 20 June 2020

Helios-One Arduino Synth - Part 3

**Update**
**End of update**

Let's add a low pass filter to our synth!


So in the third part of the tutorial for our little synth, we'll add a LPF.  We'll use two B10k pots, one for the Cut-off and one for the the resonance.  The cut-off pot also has a 220 ohm resistor on it's ground lug. Here's how it should look now;



And how it looks on the breadboard;



It's actually turning into quite a nice expressive synth.  Here's a link to the code;



Hopefully it should all be self-explanatory in the comments of the code.  The Arduino analog pots return a value of 0 - 1023, but the mozzi filter only needs a value of 0 - 255.  Originally I converted this using the map function, but then after reading through Arduino for Musicians by Brent Edstrom, I saw that it was quicker/less resource intensive to bit-shift the sum  >>2.  The original map function is still in the code (commented out)...  I think I could hear an audible difference but I could just be going mad (the bit shift version was smoother?).  Feel free to give it a try.

The part I struggled with was the updateAudio function... somehow you had to pass the output of the oscillator into the filter.  I did this by wrapping the original code into a new char, then passing that into the filter. Take a look at the code, or even better compare it to the old V2 code.  Playing with the mozzie examples, the Arduino book, and various other examples on the web, I managed to get it to work, but it would distort/cut out. So I added a resistor on the Cut-off pot, and also increased the bit shifting on the updateAudio function from 8 to 10.  It's a bit quieter now, but still usable.  We might end up adding an amp on the output to boost the signal, but we'll wait and see until it's finished.

Hopefully I shall have time to create part 4 soon...  but I haven't actually figured out what to add and we're running out of analog inputs (our last two!).  I think maybe an LFO...





Thanks!


Friday, 12 June 2020

Helios-One Arduino Synth - Part 2



**Update**
**End of update**

It's been a while coming, but thanks to lock-down I've finally managed to finish part 2 of my simple Arduino synth, the impressively titled 'Helios-One'.  Don't expect it to sound like it's name.  Although maybe, a bit like lock-down, perhaps it sounds 'sick'.  

Here's part 1 of the tutorial in case you missed it.  In that part we set up an Arduino to work with midi, and also a switch to change between wave-forms.

In this version we add Attack and Release envelopes to the synth.  We could add a full ADSR envelope, but the Arduino only has so many free inputs and I'm trying to keep this simple.  If you still want to, you could figure it out by looking at the code I'm sure, but when we add more features down the line, you won't have enough inputs unless you start using a multiplexer.  Maybe we'll end up doing that anyway, we'll see.

You'll need two potentiometers (I'm using B10k ones)

Connect center pot pin to;

A5: for Atk

A4: for Release

connect the other pot pins to ground and 5v. 



To stop mis-triggering on the attack I have two 1k resistors in parallel (amounting to 500 ohms resistance) on the ground input of the attack pot.  You could put two 200(ish)ohm resisters in series instead (it doesn't have to be exactly 500 ohms), or play with the code...  maybe set the int val of the atkVal to something over 20 instead of 0?  The resistors work for me, so I'm sticking to that.

Here's a link to the code;

https://github.com/gary909/Helios-Arduino-Synth-V2

When you upload the code, remember you need to disconnect the RX pin on the Arduino.  You also need to have the Mozzi and Midi library's installed on the Arduino software.

Hopefully part 3 won't take me quite as long this time around.

Thanks.