Electronic music - sync

From Helpful
(Redirected from PPQN)
Jump to navigation Jump to search

The physical and human spects dealing with audio, video, and images

Image: file formats · image noise reduction · blur detection · halftoning, dithering · illuminant correction · Image descriptors · Reverse image search · image feature and contour detection · OCR · Image - unsorted

Displays: Video display notes · before framebuffers · Simpler display types · Display DIY ·· Screen tearing and vsync · Arguments for 60fps / 60Hz in gaming‎‎

Video: file format notes · video encoding notes · Subtitle format notes


Vision and color perception: physics, numbers, and (non)linearity · objectively describing color · the eyes and the brain · color spaces · references, links, and unsorted stuff · Lux and lumen

Audio physics and perception: Sound physics and some human psychoacoustics · Descriptions used for sound and music · multichannel and surround · Sound level meter notes


Noise related: Stray signals and noise · sound-related noise names · electronic non-coupled noise names · electronic coupled noise · ground loop · (tape) noise reduction · strategies to avoid coupled noise · emphasis · Sampling, reproduction, and transmission distortions

Digital sound and processing: capture, storage, reproduction · on APIs (and latency) · programming and codecs · some glossary · audio noise reduction · Audio and signal processing - unsorted stuff


Music electronics: device voltage and impedance, audio and otherwise · amps and speakers · basic audio hacks · Simple ADCs and DACs · digital audio
On the stage side: microphones · what can I plug into what? · audio levels & technical gritty · devices you'll use · cables, connectors, adapters · effect hardware · sync

Electronic music and DIY:

approaches to making sounds · some history · interesting instruments · Gaming synth ·
Synth: MIDI · sync · Electrical components, small building blocks · VCO, LFO, DCO, DDS notes · microcontroller synth · audio platforms
modular synth: formats (physical, interconnects) · physical · Learning from existing devices · eurorack power supply ·· Modules/makers of note: Mutable instruments
DAW: audio plugins · Ableton notes · MuLab notes · Mainstage notes · VCV Rack notes


Unsorted: Visuals DIY · Signal analysis, modeling, processing (some audio, some more generic) · Music fingerprinting and identification

For more, see Category:Audio, video, images

Sync in audio in general

For context

Each device can actually keep very regular rhythm with an internal clock, good enough for music.

There will often be a clock crystal that isn't perfect, but the error may be measured in parts per million.

Even if it's on the order of a percent, that irregularity tends to be a slow change in rate, so we probably won't hear it in the short or longer term.



Consistent with themselves, anyway.

If all sound generation comes from one device, we're all good.


But soon, we want multiple devices to each make sounds.

If multiple devices keep their own rhythm, then however small the imprecision (could be order of 0.01%), if they don't communicate at all they will go out of sync eventually - slowly, but surely.

It may still be good enough to not matter for a ten minute performance, but you would still need to start them perfectly synchronized.

...and if you can do that, why do that just once, and not continuously?


💤 Electrically, sync is based on a square impulse, just because it's easy to generate,

and that edge of 'go from off to on as fast as you can' is electrically very well defined in time, as well as easier to produce and consume than e.g. a slope or sine. Which is why digital circuits are made of pulses and often focused on their edges.

But this is just a single event that happens to be well-defined in time.

This is a tool towards a solution, but not a solution.


Multiple clocks started at the same time

Even if one device tells another when to start, that will be in sync then, but slowly drift.

Maybe that's good enough for a three-minute song, but in any situation this isn't good enough, this is messy to work around.



Not having multiple clocks - trigger

One quick and dirty solution is

  • have nothing have a clock, and instead have inputs that mean 'when you see a pulse, make a sound'.
  • have just one central device care about all rhythm, and when to send such pulses

No matter how (ir)regular that one clock is, the others can't be out of sync.

This is how modular synths mostly work, and they seem happy, right?

In modular, where the amount of space is not a problem, and the amount of knobs is considered a feature, it makes sense to separate 'clock generator' from 'clock variation maker' and 'triggered sound makers'.

In more portable things you can drag to gigs, though, you just want distinct devices to keep in time with each other.


Not having multiple clocks - triggers advancing in many small steps

What if we tell another device when to move on to the next step in a sequence.

That makes it simple to feed the same pulses to everything, and have them all do things on a regular, e.g. four-to-the-floor beat.

This in itself is not musically interesting.

It would be hard to have one or multiple things play at different regular times in a regular beat, e.g. (e.g. an eighth-note melody over a fourth-note rhythm, a slow kickdrum and faster hihats), nor things like syncopation, off-beats, swing, triplets, slugghishly late beats, polyrhythm.

Some of that list might be manageable (e.g. playing at half speed - just ignore every second pulse), but most of the others in that list mean that the receiving device has to guess what the original one was doing.


So what if you might design devices to do different things to the same regularity?

That is, share a much faster regular grid, then configure each device to only make sounds on that grid where you want it?

Hypothetically, what if we say that instead of there being 4 steps in a measure, we say that there are 48?

If we choose to make a sound every 12th step, we get a 4/4 beat
If we choose to make a sound every 16th step, we get a slightly slower 3/4 beat in the same amount of time
If we choose to make a sound every 6th step, we get eighth notes
If we choose to make a sound every 3th step, we get sixteenth notes
...and we can
shift each them around a little too to break the feeling of strict regularity
use other numbers, that only match up after multiple measures


(That "4/4 moves on every 12 counts" is in the end an arbitrary choice. The same idea would work with things quarter, half, double, quadruple that speed, just with different counts. Higher counts give you slightly more options. What we actually did in the real world is usually faster, see e.g. MIDI's 24PPQN (twice the speed of what we just suggested), though you don't need to go a lot faster to go beyond basic music-theorhetical needs)

PPQN

PPQN (a.k.a. PPQ and TPQN) is fairly literal:

PPQN is the amount of electronic pulses (/ticks) before a listening device moves on to the next musical quarter note.


(note: electronically, a pulse [1] is a single, rigid, rapid transient that returns to its baseline. To try to avoid confusion with musical pulse, the below tries to use 'ticks' instead)

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 in application is often 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, but 8PPQN would do that; almost nothing regular needs more than that


Yet if you want to do triplets, or clave-style rhythm, you often want a factor 3 in there, on top of a factor 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 it's very easy to want at least sixteenth-note positions (4PPQN for 16 things per bar).

So now we can easily argue for 6 or 8 or 12PPQN.


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, 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, a lot of 24PPQN devices don't expose this on the knobs - because you can't really hear it.


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, actually, and was simple enough to do even in early electronic music.






Triplets, swing

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

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_notes#Beat_clock


MIDI TimeCode

MIDI Timecode, a.k.a. MTC, works out as a variant of SMPTE

Which isn't really a beat, so using it for rhythm is somewhere between 'finicky' and 'useless'
It's useful to mention, to point out that this is not the same as beat clock.
see also MIDI_notes#MTC

DIN sync

DIN sync pinout

DIN Sync[2] 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.

Note on PPQ

MIDI and DIN sync is mostly 24PPQN but there are others.




Measures

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.

Modular sync

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).

Multiplying