Skip to content

How to update current tempo/time signature in real time #270

Answered by melanchall
LeoMassaFM asked this question in Q&A
Discussion options

You must be logged in to vote

Hi,

Playback is the best choice in my opinion. Please read the library documentation. You need to subscribe to the EventPlayed event and check if it's a SetTempoEvent one:

// ...

_playback.EventPlayed += OnEventPlayed;

// ...

private static void OnEventPlayed(object? sender, MidiEventPlayedEventArgs e)
{
    if (e.Event is SetTempoEvent setTempoEvent)
    {
        var newBpm = new Tempo(setTempoEvent.MicrosecondsPerQuarterNote).BeatsPerMinute;
    }
}

But if you want to solve the task manually without Playback, I can't help you unfortunately. The area of responsibility of the DryWetMIDI ends when you get tempoChanges. What you're going to do with all those tempos is up to you. It's yo…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@LeoMassaFM
Comment options

@LeoMassaFM
Comment options

@melanchall
Comment options

@LeoMassaFM
Comment options

@melanchall
Comment options

Answer selected by melanchall
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Just question about the library
2 participants