Predictably, I’ve overextended, and everything is going horribly wrong. So you can have an early bog post this week.
The Failure
Okay, so you know how my intention was for the Arduino to work as a 4 step sequencer clocked at a high speed, in order to become an oscillator? Well, that requires the Arduino to be able to output a DC offset. And it can’t. And I knew this, but still decided everything was fine. Instead, its outputting PWM signals. So, instead of the faders controlling the amplitude of each stage, they control the Pulse Width. It still makes cool sounds, so I’m not too bothered (arguably better than originally intended). the problem is that the pitch is no longer tied to a simple Delay() call. It’s now tied to the internal PWM clock speed. Uh oh.
The problem, and how to fix it.
So, to control the pitch of the synthesizer, we need to edit the registers in real time to change the clock speed. According to this wiki post (https://docs.arduino.cc/tutorials/generic/secrets-of-arduino-pwm), the Arduino’s PWM speed is controlled first by dividing the internal system clock by a factor (1, 8, 64, 256, or 1024), and then on each iteration, increasing a register (that starts at 0) until it reaches 255. The pulse width in controlled by turning the output on at 0, and off at a selected value; the higher the value, the longer the Pulse.
Downscaling
Another, smaller problem I encountered was that the push buttons I was using for semitone and octave offsets would not stay in the board. However, due to the above ‘hack’ for frequency control, I will not be able to make much use of either of them. As we will only be able to change the pitch in ~2Hz increments, this instrument will not be able to make use of traditional pitch offsets. Combining these 2 problems left me with the decision to remove the buttons entirely.
It’s not all bad news
One good thing I have discovered is due to my faders’ dodgy connections to the breadboard – this means that small amounts of noise get into the circuit, essentially allowing for some randomized per-cycle PWM. This means I won’t need to deal with attempting unison voices as was originally planned, as traditional PWM gives a unison-like timbre

And that’s everything for this post. It’s going to be quite busy over the next few days, so expect a few more blog posts in the coming weeks, as I get ever closer to assessment week.
Until next time!