Polyphonic Synth Cable
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.
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.
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.
Will it all fit into the jack? Err yes. Yes. I wasn’t worried.
Read more: Polyphonic Synth Cable