Back to Hardware

Polyphonic Synth Cable

17 Nov 2015
Progress: Complete

This is the fourth synthesizer cable I've built, the first three being based on the ATtiny85. I have been looking into ARM chips but haven't gotten to grips with them just yet. Instead, I decided go back to the ATtiny2313, which has a quarter of the memories of the tiny85, but a hardware UART port and more pins.

It's quite a simple idea really - generate square waves by toggling the digital outputs on many pins, and sum them in analogue. This doesn't really save much processing power compared to the polyphony I used for standalone midi playback on the tiny85, which was just adding / subtracting values being sent to the PLL PWM output. But I couldn't think of a way for realtime playing with that system when the same chip had to interpret midi messages in software. The hardware UART simplifies the task. I looked, but couldn't immediately see any chip with both a UART and a PLL. So, this tactic seemed the easiest approach to a polyphonic synth cable.

Schematic of the polyphonic synth cable

It may have been easier to implement wavetable lookup with antialiasing, certainly if I went for a chip with hardware multiplication. But for pin toggling square waves, the only way to get them in tune is to operate at ludicrously high sample rates. That's easy if you're using the hardware timer/waveform generation system, which has an effective sample rate of many megahertz, but that can't be used for more than a couple of pins. Using a 20Mhz crystal, I initially ran an interrupt at about 500kHz, in which each of the 16-bit counters are incremented and the necessary pins toggled.

This worked very well but has no scope for pitch bend or modulation. I wanted to bend everything by changing the interrupt frequency, but it was running at such a small division of the master clock that the bend resolution was unacceptably low. I settled for a compromise: I slowed the samplerate down, dividing the cpu clock by about 130, that lets me bend with about 5-bit resolution. This is just about good enough to be usable for simple slides and so on. The downside is that the highest note that can be played in tune is reduced to about 3 octaves above middle C. I think it's an acceptable compromise, although it would've been nice to have just one more octave.

I've not yet added modulation. The resolution will probably be very low unless we compromise the pitch range further... I may try adding it later.

Now, for the fun bit: construction. To fit it into a midi jack is not trivial, even with a surface-mount chip. And we have to squeeze a crystal in there too.

Surface mount ATtiny2313 with crystal fitted

Crystal needs load capacitors (although actually, it usually works without. But better to be safe since we're already undervolting it for this frequency when midi-powering it). Along the bottom you can see I've started to add SMD resistors. I avoided soldering the leftmost ones directly since we want some flexibility there – that's where the test clip fits for reprogramming.

Crystal and capacitors, plus several surface-mount resistors soldered to the chip

Will it all fit into the jack? Err yes. Yes. I wasn't worried.

The circuit so far, sitting in the DIN housing

Length is a concern though, and I sawed off the backs of the pins to minimize protrusion. There's the filter cap for the data line, which I forgot to put on the schematic at the top of this page. And it probably isn't needed with the hardware UART as it claims to perform a digital lowpass filter anyway.

Capacitor and resistor soldered to back of DIN pins

Now the reservoir cap.

The Poly Synth Cable circuit before fitting inside the housing

And the finishing touches.

Poly synth cable assembly

Does it work? Pah, just my luck, I'd used the wrong value of resistors. When powered over midi, they draw too much current and it sputters and skips instructions. I then had to dismantle and replace all of them with 4k7 resistors. This was tedious and tantamount to building it again from scratch, but I did it, and now it does work properly.

The final cable looks identical to all the other synth cables I've made. I'm having to use masking tape to tell them apart (but maybe I should laser-etch some details onto them?)

A collection of synth cables

It works, it's perfectly good, and it inspired me to make the analogue breath controller module for a digital melodica. But it would be totally impractical to mass produce something as ridiculous as this. I'm sure the future lies in injecting more processing power.