Electronic music - sync
Sync in general
Devices can keep pretty damn regular rhythm with an internal clock. On the short term this is much better than people can ever hear.
However, if multiple devices do so independently, then however small the imprecision (could be order of .01%), the fact that they don't communicate means they would eventually still go out of sync.
What we typically do instead is send a shared pulse, that devices can choose to make sounds on.
There is only one source that everything else listens to, so it cannot go off.
Electrically, sync is typically a square impulse, because that is best defined electrically, and easy to produce and consume.
Functionally, sync just tells another device when to move on to the next step in a sequence.
This means there is only one clock, and everything else will keep synchronized to it. Each device will do the same thing, no matter how (ir)regular that one clock is.
This raises some questions.
Say, you can tell another device to progress on every tick, then you can only share a fully regular (e.g. four-to-the-floor) sort of beat.
You couldn't have one thing play faster (e.g. an eighth-note melody over a fourth-note rhythm, a slow kickdrum and faster hihats), things like syncopation, off-beats, swing, triplets, slugghishly late beats, polyrhythm.
Assuming the ticks are entirely regular, then doing those things comes down to how a device consumes them.
The eighth-note melody on top of quarter note beat would be served by having one device progress only every second tick.
That kickdrum-and-hihat example by making the kickdrum only react every fourth or eighth tick.
This leads to...
PPQN (a.k.a. PPQ and TPQN) is fairly literal: the amount of electronic-level pulses (/ticks) before a listening device moves on to the next quarter note.
(note: pulse is electronic/signal sense of a rapid transient that returns to its baseline, not that of musical pulse. The below tries to use 'ticks' to maybe lessen confusion)
Choosing a quarter notes seems purely because it's music theory's default. It needn't actually be a quarter note in real use, you can play things faster or slower, but when combining more than one device, it's a sensible enough common denominator.
PPQN is often seen specifically 24PPQN, e.g. in MIDI beat clock, and the earlier DIN sync.
Why 24? Why not fewer? Why not more?
Fewer exists. More exists. 24PPQN just became a convention.
Consider our needs.
If 1PPQN is a quarter note, then 2PPQN lets you talk eighth notes (and do basic syncopation/offbeats), 4PPQN sixteenths. That's already a lot of music covered - thirty-secondths are not very common.
Yet if you want to do triplets, or clave-style rhythm, you want a factor 3 in there, as well as 2 or 4.
Also, there's swing. If you want swing in an otherwise entirely regular pulse, you'ld like some extra steps where you can place it, so you quickly want to place at sixteenth-note positions (4PPQN for 16 things per bar)
So now we could argue for 6 or 8 or 12PPQN.
If you want polymeter, you can use the same musical pulse but have one thing loop earlier. This doesn't really change anything about PPQN, actuallt - and was simple enough to do even in early electronic music.
The math says you need the lowest common multiple, and it turns out that 24PPQN covers all the just-mentioned cases (and pulls in includes 32ths, even though those are hard to hear or play for most of us).
Remembering that 24PPQN means 24 input ticks move onto the next quarter note. A whole note is four of those, so 24PPQN allows
- typical ones:
- whole note (96 counts each)
- half note (48 counts each)
- quarter notes (24 counts each)
- eight notes (12 counts each),
- sixteenth notes (6 counts each)
- 32nd notes (3 counts each)
- and triplets
- quarter note triplets (16 each) (note this aligns only every second beat, at 48 ticks, 2*24 and 3*16)
- eight-note triplets (8 each; more common for musically practical reasons)
- sixteenth-note triplets (4 each),
- thirtysecondth-note triplets (2 each),
- sixtyfourth-note triplets (1 each)
Note that while 24PPQN (e.g. in MIDI) was probably aiming for 32nd notes and decent triplets, the way the least common multiple of 3 and 4 interact means it technically allows 64th-note triplets, but a lot of 24PPQN devices don't expose this - because you can't really hear it.
Triplets amount to mixing in a different meter.
If you're using MIDI input, its 24PPQN nature basically moves the issue to whatever is producing the rhythm, since it's probably doing both on different channels, or two different synced devices are doing it.
Which is the "rhythm doesn't exist in modular unless you say so" approach,
but it's also fairly simple to get two different related meters.
Pretty much all you need is two different rates, and if you have resettable (e.g. baby8) style sequencers they don't even need to be accurate to not go out of sync.
It's also easy enough to create a module that just generates triggers/gates at two or more different meters.
Although the cleverer way is often to have a faster master clock, and divide it in different ways -- like MIDI does, and it can make sense to allow doing this from MIDI input.
Swing is a little more specific to beat-making and mostly requires knowledge of where you are in a sequence, so would be part of a rhythm generator if anything.
Sync in the real world
MIDI beat clock, a.k.a. MIDI timing clock, MIDI clock, is using regular MIDI connection to transmit a (single-byte) message at 24PPQN.
- see also MIDI#Beat_clock
MIDI Timecode, a.k.a. MTC, is a variant of SMPTE
- Which isn't really a beat, so it turns out to be somewhere between finicky and useless to use for rhythm.
- It's useful to mention, to point out that this is not the same as beat clock.
- see also MIDI#MTC
 is a PPQN style pulse on a dedicated pin of a DIN socket. (A second pin set whether the drum machine should be running or paused. There are a few pinout variations.)
DIN sync is typically 24PPQN, and also known as Sync24.
Some old drum machines (e.g. some from Linn, Korg) used 48PPQN, many others 24PPQN (e.g. Roland). If DIN-synced between those, they'd go at twice/half speed. Which some people used intentionally, others has a converter box for.
Modular synth sync - there's usually just one thing keeping regular time.
All other things don't think about regularity or run their own timer at all. They just react whenever that central thing (or something that alters that, e.g. divides it) sends an event (trigger or gate).
One practical limitation to various of these is that a pulse alone can't communicate when a measure should start over, so it's not very hard to get two devices playing at the same speed, yet start/restart their measures at different times.
One workaround is to, if possible, prime each listening device at the start, and only then start the sync pulses.
Modular can sometimes may this slightly easier, by having a reset input on some modules. On some things (like baby8 style sequencers) this is part of the very basic design.