Playing Notes In Midi Edit Mode

I have two related questions regarding playing notes while editing midi in piano roll clip.

  1. How to make existing notes sound when clicked.

  2. When using a MidiKeyboardComponent on the piano roll, how to make the notes sound on the keyboard.

So, both questions are asking, how to pass the midi events through so that they are played?

You want to call AudioTrack::playGuideNote() and AudioTrack::turnOffGuideNotes

Or, if you want more control you can use AudioTrack::injectLiveMidiMessage(), but then you’ll need to keep track off note on and off yourself.

Thank you!

For my situation it was necessary to force the note,

audioTrack->playGuideNote(noteNumber, midiChannel, velocity, true, true);

which I placed in mouseDown().

I then put,

audioTrack->turnGuideNotesOff()

in mouseUp(), and it all works as expected.

I have not tried with the MidiKeyboardComponent yet, but I am expecting similar results. If I have any issues with that, I will present them here.

Thank you so much for your expert guidance.

I think we run a timer to turn guide notes off, maybe for the length of the note that is entered…
That just might avoid very short notes on quick mouse presses (it depends on the synth though).

To avoid requiring the force, override EngineBehaviour::shouldPlayMidiGuideNotes. We return true or false based on a setting.