Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass 7-bit values via NRPN #54

Open
texelec opened this issue Jul 30, 2024 · 1 comment
Open

Pass 7-bit values via NRPN #54

texelec opened this issue Jul 30, 2024 · 1 comment

Comments

@texelec
Copy link

texelec commented Jul 30, 2024

I have a Midi device based on the SAM2695 wavetable IC, and it uses 7-bit values instead of 14-bit. Can you add an option to pass 7-bit values only? I was able to get it to compile on LInux, but the windows build looks a bit more obnoxious and I'm not even sure what all I'm missing to compile it other than parts of VS2017. I only have WSL running at the moment and no MIDI support, so I need the Windows build. :-)

This is the change I made:

auto number = state.asDecOrHex14BitValue(opts_[0]);
auto value = state.asDecOrHex7BitValue(opts_[1]);
state.sendMidiMessage(MidiMessage::controllerEvent(state.channel_, 99, (number >> 7) & 0x7f));
state.sendMidiMessage(MidiMessage::controllerEvent(state.channel_, 98, number & 0x7f));
state.sendMidiMessage(MidiMessage::controllerEvent(state.channel_, 6, value & 0x7f));
//state.sendMidiMessage(MidiMessage::controllerEvent(state.channel_, 38, value & 0x7f));
//state.sendMidiMessage(MidiMessage::controllerEvent(state.channel_, 101, 0x7f));
//state.sendMidiMessage(MidiMessage::controllerEvent(state.channel_, 100, 0x7f));

Clearly this change will only support 7-bit values, but maybe an option to send 7, or 14-bit values?

The datasheet for the SAM2965 doesn't show midi command 38 is not used for NRPN in my case. Long story short, NRPN messages do not seem to be processed, but others are fine.

Also, command 101 & 101 are for RPN. Is there a reason they are called at the end? It may be something I don't understand about the spec, but I don't see any reason to need to send them here.

Thanks!
-Kevin

@texelec texelec changed the title Pass 8-bit values via NRPN Pass 7-bit values via NRPN Jul 30, 2024
@gbevin
Copy link
Owner

gbevin commented Jul 30, 2024

That sounds like the SAM2695 is not following the MIDI spec. CC 6 and 38 are the MSB and LSB for NRPN messages, the number is selected with 98 and 99 and the last NRPN or RPN number is reset with CCs 100 and 101. SendMIDI does exactly what the MIDI spec specifies. If you want to send an NRPN that's out of spec, you can always send CC messages directly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants