Sync24/DIN sync dividing using an Arduino

I’ve been fiddling with dividing a Sync24 signal for a while now, and this is the messy result.

DIN Sync box

…lots of flashing lights. Sync24 – more commonly known as DIN sync, after the connector used – is a pre-MIDI standard for synchronising drum machines and sequencers. It works at 24 pulses per quarter note, so for each bar you get 96 pulses, which the spec says should be at +2.51 volts.

The idea behind this mess of wires is to divide down the Sync24 signal – in my case from a x0xb0x or a TR-606 – and send that to arpeggiators and sequencers which step every time a pulse is received.

For example, to get a sixteenth-note pattern running off the Sync24 signal, I’d divide it by 6, but by using different dividers I could get all kinds of different rhythms.

Previously I’d tried to be all clever-like and do it with logic chips, using 4017 decade counters to do the same thing, but it didn’t quite work. The divided signal was subtlely, maddeningly out of time with the source signal. It seemed to be only a matter of a pulse or two, but it was definitely audible.

With a big sadface on, I resorted to using an Arduino instead, and over-engineered the shit out of it, because it’s fun. Here’s a demo of the work-in-progress box, triggering an MS20, a Doepfer modular, and an SH-101 sequence.

Admittedly this is a lot of shenanigans for a thump-hiss rhythm like you’d get out of a 50p car boot 70s organ rhythm box, but I hadn’t really intended it as a drum sequencer.

So to explain what’s going here, the sync signal is coming in from my x0xb0x, and we dividing it up in different ratios and sending it out to four outputs. When it’s not in edit mode, the current tempo is calculated and displayed every crotchet. Clicking on the top row of four buttons puts it into edit mode for that output. All the red LEDs indicate edit mode for that output, all the yellow LEDs indicate a trigger output, and the green LEDs show which edit mode it’s currently in (divider, offset, swing, autoreset, polarity, random trigger).

Each output can be set to run at its own divider rate, from 1:1 with the clock (96 pulses per bar) up to one pulse every four bars. The start point for each divider can be offset, in sixteenths – so like in the video, you can get a snare on the 2 and 4, for example.

Each trigger can be either positive (in the demo used for the SH-101 and Doepfer percussion) or shorted to ground (the Korg MS20 uses these).

The SH-101 sequence in the video shows me flipping into random trigger mode, which works by playing a note depending on a random number being under a certain threshold. I’m not sure how musically useful this feature is at this stage – it could be better as a way to vary accents.

You can see me muting trigger outputs by holding down the shift key on the bottom right and clicking a track edit button. I’ve left a gap in the edit mode for swing – I’m not sure if I’ll get to this, I’m going to check out the swing on my 707 to see how it does it.

Not demo’d in the video, but I’ve taken some inspiration from the 4ms rotating clock divider and added an autoreset feature – each output can be set to automatically reset after so many clock pulses. I’m planning that this reset could also be triggered from an external clock pulse, I’ve a few analogue pins left over. I’m also wondering about whether to add a rotate input, and an AND/OR output, which could either AND or OR the signals from the four outputs together to one, really quite rhythmically odd output.I’ve had it running off my TR-606, which has a range of about 35bpm to about 235bpm, and once it got to much above 200bpm I noticed that it wasn’t keeping up. Not that I write much gabba, but I fixed it by running the (Sparkfun 7 Segment) display at 57600bps rather than the stock 9600bps. Took a while to work this out, ‘cos Adafruit’s own documentation is wrong, but here’s the necessary lines of code, I’m using NewSoftSerial as the interface, so assume that I’ve new’d up the mySerialPort earlier


mySerialPort.begin(9600);
mySerialPort.print("v");
mySerialPort.print(B01111111,BYTE); ?? // 127 in decimal
mySerialPort.print(B00000110,BYTE);?? // 6 in decimal

Next time around you can write…


mySerialPort.begin(57600);

…and it should start up at the quicker rate.

I’ve bunged the Arduino sketch up on Github, ‘scuse the rather agricultural C, it’s a work-in-progress.

3 comments

  1. 3rd July 2018Geir Birgisson says:

    Hi there, awesome work, because I love DIN Sync as the master. Back home in Iceland I have a CR-8000 and. KPR-77 which act as masters in my MIDI setup (SBX-10 takes care of the conversion).
    I’m a total noob when it comes to code but I did find these two ESP8266 (NodeMCU) for dirt cheap at a used store and I knew they could be useful…
    I thought maybe it’s possible to have them convert a 48 PPQN DIN Sync from my Korg DDM-110 to MIDI? Can I modify (i.e. “subtract” and simplify) your code to become that? 😛

    Thanks a ton in advance!

    -Geir Helgi

  2. 3rd July 2018ua726 says:

    If you just want a basic DIN Sync to MIDI converter, and presuming the ESP has some sort of Arduino framework going on, try this? https://gist.github.com/equaliser/92142feeeef9b9247fcd046171a99ac9

    That’s a cut-down version of something I hacked up a while ago; I’ve haven’t tried this version, it compiles at least. If there’s no digitalWriteFast() method, you might want to replace that with plain old digitalWrite().

    If the ESP runs at 3.3V you might need to reduce the resistance between the board and the DIN Sync socket for some MIDI devices.

  3. 3rd July 2018ua726 says:

    One problem with this approach is that we’re reacting to something external; if we generated the clock onboard the microprocessor, we could spit out DIN Sync and MIDI and triggers with a bit less delay.

    Also also if the ESP runs at 3.3V, does it have 5V tolerant digital inputs? You might need to buffer or clamp the input from the Korg to avoid damaging the ESP digital inputs.

Write a comment: