Hello !
noob question:
I want to input midi to set the cutoff of a filter,
My AudioProcessor::ProcessBlock receive the juce::MidiBuffer& but I don’t understand how I’m suppose to extract the midi note from the raw midi data…
Thanks for your help !
Hello !
noob question:
I want to input midi to set the cutoff of a filter,
My AudioProcessor::ProcessBlock receive the juce::MidiBuffer& but I don’t understand how I’m suppose to extract the midi note from the raw midi data…
Thanks for your help !
Look at the arppegiatorplugindemo example which processes incoming MIDI data.
That’s the first place I went to, but this Tutorial use midiMessage, and the fonction gives me midiBuffer
Sorry. Then as @leehu, suggested:
https://docs.juce.com/master/tutorial_plugin_examples.html#tutorial_plugin_examples_arpeggiator
void processBlock (juce::AudioBuffer<float>& buffer, juce::MidiBuffer& midi) override
{
// the audio buffer in a midi effect will have zero channels!
jassert (buffer.getNumChannels() == 0); // [6]
// however we use the buffer to get timing information
auto numSamples = buffer.getNumSamples(); // [7]
// get note duration
auto noteDuration = static_cast<int> (std::ceil (rate * 0.25f * (0.1f + (1.0f - (*speed))))); // [8]
for (const auto metadata : midi) // [9]
{
const auto msg = metadata.getMessage();
if (msg.isNoteOn()) notes.add (msg.getNoteNumber());
else if (msg.isNoteOff()) notes.removeValue (msg.getNoteNumber());
}
midi.clear(); // [10]
Thanks a lot !
It’s exaclty what I was searching for !
I looked in the exemples but the arpegiator flew under my radar ![]()
Thanks !