midiEventsPlayedFilter
Description​
Gets or sets the midi events which will trigger the midiEventsPlayed
event. With this filter set you can enable
that alphaTab will signal any midi events as they are played by the synthesizer. 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.
midiEventsPlayedFilterJavaScript |
alphaTab('midiEventsPlayedFilter')jQuery |
MidiEventsPlayedFilter.net |
midiEventsPlayedFilterAndroid |
Types​
alphaTab.midi.MidiEventType[]JavaScript |
IList<AlphaTab.Midi.MidiEventType>.net |
alphaTab.collections.List<alphaTab.midi.MidiEventType>Android |
Default Value​
[]
Examples​
- JavaScript
- jQuery
- C#
- Android
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.metronomeNumerator);
}
}
});
$('#alphaTab')
.alphaTab('midiEventsPlayedFilter', [alphaTab.midi.MidiEventType.AlphaTabMetronome])
.on('alphaTab.midiEventsPlayed', (e, args) => {
for(const midi of args.events) {
if(midi.isMetronome) {
console.log('Metronome tick ' + midi.metronomeNumerator);
}
}
});
var api = new AlphaTabApi<MyControl>(...);
api.MidiEventsPlayedFilter = new MidiEventType[] { AlphaTab.Midi.MidiEventType.AlphaTabMetronome };
api.MidiEventsPlayed.On(e =>
{
foreach(var midi of e.events)
{
if(midi is AlphaTab.Midi.AlphaTabMetronomeEvent metronome)
{
Console.WriteLine("Metronome tick " + metronome.MetronomeNumerator);
}
}
});
val api = AlphaTabApi<MyControl>(...);
api.midiEventsPlayedFilter = alphaTab.collections.List<alphaTab.midi.MidiEventType>( alphaTab.midi.MidiEventType.AlphaTabMetronome )
api.midiEventsPlayed.on { e ->
for (midi in e.events) {
if(midi instanceof alphaTab.midi.AlphaTabMetronomeEvent && midi.isMetronome) {
println("Metronome tick " + midi.tick);
}
}
}