Electronic music - sync: Difference between revisions

From Helpful
Jump to navigation Jump to search
(2 intermediate revisions by the same user not shown)
Line 49: Line 49:
PPQN (a.k.a. PPQ and TPQN) is fairly literal: the amount of electronic-level '''p'''ulses (/'''t'''icks) before a listening device moves on to the next '''q'''uarter '''n'''ote.
PPQN (a.k.a. PPQ and TPQN) is fairly literal: the amount of electronic-level '''p'''ulses (/'''t'''icks) before a listening device moves on to the next '''q'''uarter '''n'''ote.


{{comment|(note: pulse is electronic/signal sense[https://en.wikipedia.org/wiki/Pulse_(signal_processing)] of a rapid transient that returns to its baseline, not that of [[musical pulse]]. The below tries to use 'ticks' to maybe lessen confusion)}}
{{comment|(note: electronically, a pulse [https://en.wikipedia.org/wiki/Pulse_(signal_processing)] is a single rapid transient that returns to its baseline. To maybe 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.
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.
Line 64: Line 64:


Consider our needs.
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 will do that; almost nothing regular needs more than that


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.
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 you quickly want to place at sixteenth-note positions (4PPQN for 16 things per bar)
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 could argue for 6 or 8 or 12PPQN.
So now we can easily 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,
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).
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  
Remembering that 24PPQN means 24 input ticks move onto the next ''quarter'' note, 24PPQN allows  
: typical ones:
: typical ones:
:: whole note (96 counts each)
:: whole note (96 counts each)
Line 100: Line 99:
:: sixtyfourth-note triplets (1 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 [https://en.wikipedia.org/wiki/Least_common_multiple 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.
Note that while 24PPQN (e.g. in MIDI) was probably aiming for 32nd notes and decent triplets, the way the [https://en.wikipedia.org/wiki/Least_common_multiple 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.
 
 




<!--
<!--


'''Are there other reasons for higher PPQN?'''
'''"Are there other reasons for higher PPQN?"'''


Yes.  
Yes.  


But this gets interesting.
This gets interesting, and then boring.




The first question is how fast a basic rhythm can be.
The first question is how fast a basic rhythm can be.


Walk over to a drum machine and sequence it with 32th notes (for which 8PPQN is enough) at even just a moderate 120BPM.  
Walk over to a drum machine and sequence it with 32th notes at even just a moderate 120BPM.  


That's not a coherent rhythm anymore. This relates to the way our brain resolves rhythm and tone - the two are different mechanisms, and there's a dead zone where it's not really perceived as either.  Events at &gt;~10Hz (&gt;600bpm) beat can't be described as coherent rhythm for people (and depending on the waveform it triggers, that'll produce a low note).  
That's not a coherent rhythm anymore. This relates to the way our brain resolves rhythm and tone - the two are different mechanisms, and there's a dead zone where it's not really perceived as either.  Events at &gt;~10Hz (&gt;600bpm) beat can't be described as coherent rhythm for people (and depending on the waveform it triggers, that'll sound like a low note largely due to overtones).  


So 24PPQN is basically beyond the requirements for rhythmic coherency of regularly triggered sounds.
And the above could be done with just 8PPQN - if regular.
So 24PPQN is well beyond the requirements for rhythmic coherency of ''regularly'' triggered sounds.






But that's not the only need.  
Yet that's not the only need.  


'''The above assumes you want strict regularity. If you like things like swing, you don't want it to snap to the beat'''.
'''The above assumes you want strict regularity. If you like things like swing, you don't want it to snap to the beat'''.




It turns out that at regular music's ~100bpm pace, we can half-consciously tell the difference between ''entirely'' regular and ''not quite'' regular.
While for some genres where this is an expectation (techno is almost always regular, jazz almost never is),
there are plenty of examples (e.g. rock) where strict regularity will sound a bit artificial to us, even if we can't directly say why.


It turns out that at regular music's ~100bpm pace, we can half-consciously tell if it is ''entirely'' regular or ''not quite''.
It turns out we ''like'' the light irregularity of human input.  
While this is hard to fully separate from musical styles/genres (techno is always regular, jazz never is), there are plenty of examples (e.g. rock) where strict regularity will sound a bit artificial to us, even if we can't directly say why.
 
It turns out we ''like'' the light irregularity from human input.  
Guitars are often played with some delay, and some small amount of sloppiness, which is often part of people's sound - it sounds more human.  
Guitars are often played with some delay, and some small amount of sloppiness, which is often part of people's sound - it sounds more human.  


Similar for drums, more so in slower beats{{verify}} because this is more easily perceived as tension, sluggishness, laziness.
Similar for drums, more so in slower beats{{verify}} because this is more easily perceived as tension, sluggishness, laziness.


You can get DAWs to generate random little offsets to notes, to get a similar effect.


Consider e.g. J Dilla, known for his interesting irreglar beats.  
Consider e.g. J Dilla, known for his interesting irreglar beats.  
e used an early MPC - but unlike most other people, he turned quantize off.
He used an early [https://en.wikipedia.org/wiki/Akai_MPC MPC] - but unlike most other people, he turned quantize ''off''.
 
 
You can get DAWs to generate random little time offsets to notes, to get a similar effect.
 






If your device happens to work in a strictly regular pattern,  
If your device happens to work in a strictly regular pattern,  
then if it just happens to run a few times faster,  
then if it just happens to count run a few times faster,  
that gives you a ''lot'' more ability to add a swing-like feel.
that gives a lot of extra spots a beat can land - which at that ''faster'' speed is still regular,
but at the musical speed is off-beat, and adds the ability ability to add a swing-like feel.


Yet for this, you rarely need more than 16th, ''maybe'' 32nds, so 24PPQN is also already more than you need.
For this, you rarely need more than 16th, ''maybe'' 32nds, so 24PPQN is also already pretty good.


And 96PPQN gives you better-than-128th-note intervals.  
And 96PPQN gives you better-than-128th-note intervals.  
Line 156: Line 166:
Studies find that the absolute time our brain can resolve goes down to somewhere in the range of 2 to 20ms, depending a little on context, and how trained you are.
Studies find that the absolute time our brain can resolve goes down to somewhere in the range of 2 to 20ms, depending a little on context, and how trained you are.


Which isn't actually the answer we're looking for, but it gives a good suggestion of what kind of imprecisions are no longer perceived.
Which isn't actually the answer we're looking for, but it gives a good ballpark of what kind of imprecisions are no longer perceived.




Line 174: Line 184:
That's already moderately close to the trained listeners.
That's already moderately close to the trained listeners.


And remember that J Dilla example? It turns out turning quantize off on that MPC actually meant it went to 96PPQN,
because that was the internal rate of early MPCs.


And remember that J Dilla example?
It turns out turning quantize off on that MPC actually meant it went to 96PPQN, because that was the internal rate of early MPCs.


More? Sure. Maybe a few hundred PPQN to be safe, tops, for the most extreme of uses, assuming we need to hit that 2ms, or a little better.
 
Could we use more? Sure. Maybe a few hundred PPQN to be safe, assuming we need to hit that 2ms, or a little better.






...and then the gearheads enter, arguing e.g. that you must have sub-millisecond accuracy throughout the range so more more more!
...and then the gearheads enter, arguing e.g. that you must have sub-millisecond accuracy throughout the range so more more more!
Never mind that at 30BPM, which is one beat every two seconds -- you are just ''not'' going to perceive millisecond accuracy.
 
''At all''.


...and then DAWs enter, and that figures that if you promise 4096 or 9600, you may catch a few more customers.
...and then DAWs enter, and that figures that if you promise 4096 or 9600, you may catch a few more customers.
Presumably the only reason reason they don't go higher is that someone will call them out of the fact that ''that'd be shorter than a single audio sample''.
Presumably the only reason reason they don't go higher is that many people would call them out of the fact that ''that'd be shorter than a single audio sample''.
-->
-->


<!--
<!--
Well, 24PPQN is already pretty fast, roughly a dozen milliseconds (depending on actual BPM).
You have to be a pretty  well trained artist to get a sixteenths in with any consistency.
Also keep in mind that due to speed of sound and distance, there are delays and synchronization limits. Consider the distance between a guitar cab and the mic pointing at it,
and the distance within an orchestra (...but there's many footnotes to the last that help).
So 24PPQN is on the order, enough for some uses but maybe not all, so we can throw a few more factors at it just to be on the safe side.
This is basically an argument for 96PPQN, which most consider good enough for most human-sounding variation to rhythms.
Apparently 96 for the 1000 and 2500, 960 for the 4000 and 5000






And there is argument for quantizing somewhere slower than that,  
And there is an argument for quantizing somewhere ''slower'' than that,  
for consistency ''within'' your deviations of of continuous playing, e.g. to sixteenths or so (still slower than 24PPQN).  
for some limited consistency ''within'' your deviations of live playing,  
e.g. to sixteenths or so (still slower than 24PPQN).  


Consider also that 24PPQN at 120BPM is about 20ms, so 96PPQN at 120BPM is 5ms.
Consider also that 24PPQN at 120BPM is about 20ms, so 96PPQN at 120BPM is 5ms.
Line 218: Line 218:
But when more than one things plays
But when more than one things plays
it's a lot more practical to record human input into something quantized so finely that  
it's a lot more practical to record human input into something quantized so finely that  
So how much is enough?
For rhythmic structure, it's quite low.
However, delays
The first is '''regular pulses'''. For a strictly regular 4/4 beat, 1 PPQN will do. And just describes 'respond on every single one of the regular ticks'.
It won't allow notes between the quarter notes, or swing.
For an eight-note offbeat you'ld want 2PPQN, for triplets you'd need a multiple of three, for
for swing probably a little more, and 24PPQN covers all of that.
Between devices, PPQN only really matters if you want more than one to independently do such off-the-beat things.
'''On different pulse interpretations'''


-->
-->

Revision as of 16:54, 16 October 2023

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

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

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

Video: format notes · encoding notes · On display speed · Screen tearing and vsync


Audio physics and physiology: Sound physics and some human psychoacoustics · Descriptions used for sound and music

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


Digital sound and processing: capture, storage, reproduction · on APIs (and latency) · programming and codecs · some glossary · 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 · multichannel and surround
On the stage side: microphones · studio and stage notes · Effects · sync


Electronic music:

Electronic music - musical terms
MIDI · Some history, ways of making noises · Gaming synth · microcontroller synth
Modular synth (eurorack, mostly):
sync · power supply · formats (physical, interconnects)
DAW: Ableton notes · MuLab notes · Mainstage 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

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 0.01%), the fact that they don't communicate means that these separated sources of clock signals will eventually still go out of sync.

They typically go out of sync so slowly that it wouldn't matter for a musical performance, but without a means to tell both to start at the same time, each is really just doing their own thing.



On musical devices, what we typically do is send a pulse to all devices. Each device can then choose to make sounds on each pulse (or every so many pulses).

There is only one source that everything else listens to, so they can't go out of sync. Each device will do the same thing at the same time, no matter how (ir)regular that one clock is.



Electrically, sync is typically a square impulse, because that is best defined electrically (that near-instantaneous edge is handier than a slope), and square waves are easy to produce and consume.


Functionally, sync just tells another device when to move on to the next step in a sequence.

This raises some questions.

Say, you can tell another device to progress and make a sound on every tick, then you can only share a fully regular sort of beat, e.g. a four-to-the-floor 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), nor 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

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: electronically, a pulse [1] is a single rapid transient that returns to its baseline. To maybe 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 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, but 8PPQN will 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, 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_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.


Also, devices designed to interact with modular and/or some obscure drumkits may like a choice to emit 1, 2, 4 PPQN -->



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