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

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?

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

1 Like

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!

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

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.

Update: To any who might come across this post, I solved the problem by updating/reinstalling both Reaper and JUCE. My best guess is that there was a transposition setting somewhere in Reaper that I was unable to find that got reset after the update/reinstall.