22 Sep 2023
Progress: Complete
Time for another synthesizer. It’s not for sale, just for fun. Here’s a video where I demonstrate what the synth can do and talk a bit about it:
I met Dave at EMF. I was thoroughly impressed with his creations, but I was not prepared for the scale of his modular synthesizer. It’s enormous! I also loved everything else in that room, not just the wall filled with other synthesizers, but even those sculptures on the right hand side. Upon closer inspection, they turn out to be synthesizers he’s built.
Obviously when I visited I took a tiny box filled with synthesizers I’d made. One of them was the hardware reverse oscilloscope which felt like something that should be part of a bigger synth, but it was surprisingly tricky to get them to work together. I hadn’t built anything with a CV input or output. It was also pointed out to me that the little device was essentially the same as one of the sequencer modules, sped up, which is true, excepting the output capacitor. But the software version of the reverse oscilloscope is quite different. Having multiple oscillators and a waveshaper changes everything.
I should explain a little about the software synth. I originally wrote it in about 2012, and then for years kept adding more and more features to it. The interface was incomprehensible, a stream of consciousness spattering of knobs and sliders. In early 2016 I decided to re-write the synth from scratch. I made a completely new interface, both more visually appealing and more intuitive. It was awesome, although I never completely finished it. I never released it, but you can hear it in some of my videos, including the stylophone business card. (There’s a thousand comments on that video saying how cool it sounds, and not one person asked which synth it was connected to.)
I decided to build a new synth, something in-between the software and hardware scopes.
RScope mk. 2
The original hardware reverse oscilloscope was an analog multiplexer, driven by a binary counter, driven by one of my tiny square-wave midi synths. I liked very much how it was just simple hardware – and the design meant it was completely free of aliasing.
I wanted this to be all hardware too, despite the fact that I wanted it to have a lot more features. We can do multiple oscillators, just have multiple multiplexers and buffer the signal where needed. We can do the interpolation, just about. It would need a filter with perfect pitch tracking, but that’s not out of the question. The hardest part would be the waveshaper. The cyclic nature is equivalent to a modulo function, and doing a modulo of a voltage is most of the way towards building an ADC.
Due to unforeseen circumstances, I didn’t have nearly as much time to work on this as I’d expected, but I still wanted to make it in time for the visit, even if that meant serious compromises. I find working towards casual deadlines like social events to be when I do some of my best work. I may have cut every corner, but at least the synth got finished. By far the biggest corner to cut was to avoid hardware as much as possible, do it all on a microcontroller. This introduces all kinds of other problems, but nothing we can’t fix.
The waveshaper algorithm is something I came up with years ago, by accident. It’s very easy to implement in DSP, but like all waveshapers, it’s extremely prone to aliasing. The only way to avoid this is to pre-filter the signal, or oversample the waveshaper. Each doubling of the waveshaper samplerate gets us one more octave of headroom. I want all of the headroom. I set one of the pins on the DSP chip to go high when we start processing, and low when we finish, so the duty cycle tells us the load on the processor. Once the algorithm was written, I then just kept doubling the samplerate as many times as possible before we run out of processing power. It ended up as a 64x oversample, or six octaves of headroom.
Architecture
I’ve gotta stress that this wasn’t particularly well thought out. I had ordered the Teensy 4.0 a while back to use on another project that never came about, but it’s 600MHz which now sounded perfect for my waveshaper. For reasons that may not have entirely made sense, I thought it would be better to have the interface handled by a separate microcontroller, and keep the teensy for just audio processing. I went with the pico since they’re cheap and available. And then, when I realised the pico doesn’t have the current capability to run the LEDs directly, I was about to add some shift registers to drive them when I figured that in terms of soldering it was about the same as wiring up an atmega chip, which could then listen directly to the serial data, so we don’t need to do anything extra on the other processors.
I started by wiring up the 16-bit ADC, which is read over i2c.
There was some concern about whether this would read the pitch fast enough. The audio buffer will be 128 samples, which at 44100Hz is about 2.9ms, or 344.5Hz. We need to report the complete state of the interface every 2.9ms, and that includes reading the pitch over i2c. I put the ADC into continuous-conversion mode at its second-highest samplerate of 475 samples per second. There may be some interference effects reading it at 345Hz, but if there were I didn’t notice it.
But to read it this quickly means fast i2c, and the pullup resistors on that breakout board weren’t sufficient. I strengthened them by soldering extra resistors on top.
I wired the atmega up to drive the LEDs directly with 100ohm current-limiting resistors. The atmega was powered from a separate buck regulator, the idea being I could adjust the brightness by varying the voltage to the chip. It turns out that the different ports on the atmega have different current capabilities. I can’t even remember if I wired them up as sinks or sources, but the LEDs on port C were noticeably dimmer. When I finished up the synth after the event, I added more current limiting resistors, and connected the atmega straight to the 5V supply (as part of my endless quest to reduce power supply noise).
But I’m skipping ahead of myself. The biggest task was wiring up the sliders. The part number for the particular slider I’m using is PTL60-15O1-103B2. That’s 60mm travel, orange LED, 10K resistance. I accidentally got the ones with a centre-detent, but that actually seems kind of handy for our waveform.
Incidentally, the LED is removable, you can just pull it out to replace it.
I thought I would be really clever about this, and socket all of them. I took some female header pins and laser-cut a frame to hold them, with laser marks for each group of four.
On the underside, I wired up one of the 16-channel multiplexers, along with a 3.3V linear regulator.
This arrangement let us hot-swap the sliders. In my haste, I wired up the sliders incorrectly the first time, and almost destroyed them. But worse than that, it soon became apparent that the header pins just weren’t a good connection, most of them wobbled and made partial contact as you adjusted the slider. Eventually I conceded (very late in the day) that it just wasn’t going to work, and I needed to solder to the sliders properly.
Luckily, I have a laser cutter, and the sliders have mounting holes. A few seconds of cutting gave me a mounting plate to transfer the sliders to, where I could then re-solder the connections on the back. Here’s a test-cut in cardboard before the real thing:
I ordered a load of M2 screws to mount them as a very last-minute thing. That actually held me up, and I couldn’t do anything further on the sliders until they arrived. In the picture above, I’ve arranged some knobs to try and get an idea of where they’ll go. I still wasn’t sure how many knobs I was going to have.
You can also see the audio output board, that’s an I2S chip wired to the teensy. The line-level output was fine for testing, but even connecting it to my speakers would brown-out at higher volumes. It definitely needed amplification – but that could wait.
The real laser-cut panel was done in matt black acrylic. The result is absolutely gorgeous, I’m not sure why I’ve never used this material before.
CV inputs
Given the time pressure, the primary concern was how to build this with as little soldering as possible. Ordinarily there would be a huge amount of soldering. Even with the synth being digital, it’s standard to buffer every input signal, which lets you add trimpots for offset and gain. I did some research, and it seems there isn’t really a standard for the voltages in use. A normal gate signal might be 0 to 5V. An oscillator output might be -5V to +5V, and even a “standard” 1V/oct pitch CV could be 0 to 10V, or -3V to +8V, or -5V to +5V. To support everything, we’re looking at a lot of opamps.
None of this is standardised, but it’s conventional to have 1kOhm output impedances on everything (except pitch signals, which may still have 1k but with the feedback tapped after the output resistor) and to have 100K inputs. And every input needs to cope with any possible voltage, and nothing should break when patch cables are connected in stupid ways, outputs to outputs and so on.
The fastest way to have CV inputs is to use 100K trimpots to drop the voltage to the right range, and use clamping diodes to protect the circuitry from voltages outside that range.
(Potentiometer shown as two resistors for clarity. 3.3V is 66% of 5V)
We’ve already got the 16-channel multiplexer for the sliders, so we may as well add another one to do the knob