Reaper MidiNote 60 appears to Juce as MidiNote 48... whom do I believe?

#1

Hello, all! I’m presently using Reaper (sequencer software) to test my Juce code. I’ve built a VST plugin that is intercepting midi from the host as shown below:

void AudioProcessor::processBlock (AudioBuffer<float>& buffer, MidiBuffer& midiMessages)
{
        ScopedNoDenormals noDenormals;
	auto numSamples = buffer.getNumSamples();
	buffer.clear();

	processBlockBasic(buffer, midiMessages, numSamples);
}

Inside processBlockBasic() is the usual Midi Iterator loop which is feeding into another class that stores the MidiNoteNumber, MidiNoteVelocity, and timestamps.

For brevity, I’m omitting the details of the nested function calls, but you should get the general idea of what’s going on by looking at the code below:

MidiMessage msg; int offset(0);

for (MidiBuffer::Iterator i(midiMessages); i.getNextEvent(msg, offset);)
{
	if (msg.isControllerOfType(64))
	{
		respondToPedal(msg); 
	}

	else if (msg.isNoteOn() || msg.isNoteOff())
	{
		handleNoteEvent(hostInfo, msg, offset);
	}

	else if (msg.isControllerOfType(1) || msg.isPitchWheel())
	{
		handleControllerEvent(hostInfo, msg, offset);
	}
}

The problem I’m having is that Juce tells me a sequence of notes is coming in as MidiNoteNumber 48, whereas the Reaper midi editor shows the same notes as MidiNoteNumber 60. I have no octave offset configured in the host insofar as I can tell, nor am I doing anything “funny” to the MidiBuffer messages that Juce delivers.

I am wondering if anyone else has encountered this behavior with Reaper (or other hosts) and if so, what is your recommended workaround? Transposing the notes up an octave in the code seems likely to cause problems in other hosts that perhaps are in agreement with Juce about the note number.

Thoughts?

0 Likes

#2

It’s just not consistent between different MIDI implementations. Provide an option for the user the set the octave offset…

1 Like

#3

I see. So I can expect different hosts to report different octaves. Unfortunate, but unavoidable, I suppose. Yes, I guess I’ll have to include a user offset as you’ve pointed out. Thanks for the quick response!

0 Likes

#4

There is a name difference regarding Middle C known as Yamaha VS Roland notation but it should be for the name only not for the actual MIDI note.

I suppose that Reaper tells you C3 and not MIDI note 60

0 Likes

#5

Incorrect. I’m speaking of (and looking at) the midi note number (value of 0 to 127), not the sequencer’s interpretation of middle C. And, incidentally, Reaper’s middle C is C4. But again, this is irrelevant to the problem described. Thanks nevertheless for your response however.

0 Likes