Ableton / push-interface

The Ableton Push 2 MIDI and display interface manual.
647 stars 74 forks source link

Setting the tempo for light transitions #3

Closed bja-ableton closed 8 years ago

bja-ableton commented 8 years ago

Could you give more information on how to set the tempo. The paragraph says:

"The transition duration refers to the MIDI clock sent by the host (MIDI system real time messages 0xF8, 0xFA, 0xFC, 0xFB). If the host never sent a clock, the animation runs at a reference tempo of 120 bpm. If the host clock stops, the animation continues running at the last received tempo."

I'm not aware of how these messages are used to control tempo.

uucidl commented 8 years ago

I think you should read documentation about the MIDI Clock messages. The protocol is actually rather simple. See https://en.wikipedia.org/wiki/MIDI_beat_clock which contains almost all there is to it!

Basically if you want to send a tempo to the device, you send F8 messages 24 times every quarter note for that tempo

benbenbenbenbenbenbenbenben commented 8 years ago

Ah great, thanks Nicolas! I thought the MIDI specification was basically closed so didn't look around too hard. Anyway, I think it might be useful to add more detail here, because elsewhere the specification is fairly self-contained - this part was unusual in requiring additional knowledge.

uucidl commented 8 years ago

Yes, and I agree that it's good to add a little bit more there :)

brunchboy commented 8 years ago

As it stands, I am going to be doing my own flashing animations because MIDI clock is too blunt an instrument for me, I need (for example) the Tap Tempo button to flash exactly during the first eighth of the beat, and MIDI clock does not track tempo changes instantly, nor does it identify when a beat begins.

It would be nice to have a sysex message that could instantly set a precise tempo, in at least hundredths of BPM, as well as establishing the current beat phase (if only saying that the next beat begins upon receipt of the message).

That is the level of sync precision my lighting control software is obtaining from Pioneer DJ Link Pro, and from my custom Traktor beat phase mapping, and I maintain it throughout my user interface.

(This is a low priority request for me, since I already do my own color/intensity animation using direct RGB values when updating the whole surface of the Push at 20 FPS, but might be useful to others who would like to use your built-in LED animations.)

rsu-ableton commented 8 years ago

Syncing the animations using MIDI clock is actually quite precise because it is a phase sync, not a tempo sync. So, when start (0xFA) or continue (0xFB) is received, the global animation phase counter is reset, and each clock (0xF8) increases it by 1/24th beat. Therefore the precision is equal to the audio precision you can get from a traditional synthesizer, or even better because USB is faster than serial MIDI. And since the ear is more sensible to timing than the eye, it should be great for video.

Only after receiving stop (0xFC) the averaged tempo is used, which of course will not be very precise unless you had a steady tempo for quite some time, but Live or whatever sequencer you use will not play in this situation, so the user wouldn't notice.

I agree, though, that it's really sad that the MIDI standard did not foresee to send the tempo as part of the MIDI clock. In Live, where the phase is not sufficient because the tempo might influence the pitch, so the tempo must be stable, we went through big efforts to get a good tempo signal out of the MIDI clock a couple of years ago.

brunchboy commented 8 years ago

Oh wow, very interesting. That is essentially the approach to metronome syncing I am taking in Afterglow itself, but I had never seen it expressed so concisely. (Although I have to do tempo averaging all the time as well since I often need to send out frames of light show data in between receiving MIDI clock pulses.)

And you are right, if I send start/continue messages at the appropriate point whenever my own phase has been reset, it would work great. I may explore that approach in a future release, and send fewer MIDI messages, relying on the Push 2’s internal animations more.

rsu-ableton commented 8 years ago

I forgot to mention that the global animation phase is used only for blinking and pulsing animations. One-shot animations are all individually phased, so these are probably what you would want to use.

Updated the manual with some more details about the MIDI clock vs. animation.

brunchboy commented 8 years ago

That’s great, thanks. For now I have the buttons and pads working the way I want (including waiting for responses when gathering the palette entries at startup), and have moved on to redesigning the aspects of my user interface that were drawn in the text area of the original Push. On that platform I had already crated new paradigms for light show control, but Push 2 and its color graphic display is definitely taking it to another level. I have so many incredible ideas I am impatient to try out. This is going to be a very busy weekend! :tada: