Skip to main content

midiEventsPlayed

since 1.2.0

Description​

This event is fired when the synthesizer played certain midi events. This event is fired when the synthesizer played certain midi events. This allows reacing on various low level audio playback elements like notes/rests played or metronome ticks.

Refer to the related guide to learn more about this feature.

Also note that the provided data models changed significantly in {@version 1.3.0}. We try to provide backwards compatibility until some extend but highly encourage changing to the new models in case of problems.

Examples​

const api = new alphaTab.AlphaTabApi(document.querySelector('#alphaTab'));
api.midiEventsPlayedFilter = [alphaTab.midi.MidiEventType.AlphaTabMetronome];
api.midiEventsPlayed.on(function(e) {
for(const midi of e.events) {
if(midi.isMetronome) {
console.log('Metronome tick ' + midi.tick);
}
}
});