Change tempo while playing

Hi!

I’m wondering if it is possible to smoothly change tempo while playback is running. The StepSequencerDemo project has a tempo slider but it rewrites the tempo track:

edit.tempoSequence.getTempos()[0]->setBpm( ... )

This makes the playback position “jump” when changing the tempo. What I would like is a tempo slider that changes tempo from the current position (preferredly without rewriting the tempo track at all). Would that be possible?

Thanks!
Erik

This should work if you use TempoSetting::setBpm as it internally remaps everything with a EditTimecodeRemapperSnapshot.

Then when the new playback graph is created, the playhead should be adjusted to be in the same beat position. If you search EditPlaybackContext for hasTempoChanged, that should be true when you change tempo.

Is that not working for you?

Well, it sort of works: the tempo does change and the playhead stays more or less in the same position. But the change is not very smooth; for one thing it makes some notes play back twice (which I guess is because of some scheduling lookahead). That is not a big problem, just a tiny bit annoying. But worse, the “flow of the music” is abrupted.

This can easily be demonstrated in the StepSequencerDemo by commenting out the first line in sliderValueChanged so that the tempo changes while dragging the tempo slider (and not just when releasing the mouse button). Now while dragging the tempo slider, the effective tempo is lowered.

I realize that this may be an edge case but for my use case I would really like a “live” tempo slider in the application, like e.g. in Ableton Live. Do you think that would be possible using the Tracktion Engine?

Erik

Hmm, this might just be an issue with the note-handling in the internal plugins used in the StepSequencerDemo

If I do a similar test in Waveform e.g. add a MIDI clip, set an arp pattern, loop it over a few bars and add a synth then click the BPM and move the slider up and down, the tempo change is pretty smooth?

Thanks, I’ll do some more testing!