Cockos Incorporated Forums Midi Note Name & Octave to Note Number
 User Name Remember Me? Password
 Register Track Bugs/Feature Requests Search Today's Posts Mark Forums Read

 Thread Tools Display Modes
 06-06-2019, 05:02 AM #1 MusoBob Human being with feelings     Join Date: Sep 2014 Posts: 840 Midi Note Name & Octave to Note Number In Reaper I can find mute midi note but not lock midi note from transpose (but still move left/right). I just have user input for start note and end note end note F0 start note C0 and need to convert to note numbers in Lua. This will exempt the keyswitch notes from being snapped to chord or scale. __________________ ReaTrakStudio Chord Track for Reaper forum www.reatrak.com
 06-06-2019, 12:08 PM #2 MusoBob Human being with feelings     Join Date: Sep 2014 Posts: 840 I found this in Java note number to note name, I will try and work it out to Lua note name to note number, but if anyone already has the answer that would help. Code: ```octave = int (notenum / 12) - 1; note = substring("C C#D D#E F F#G G#A A#B ",(notenum % 12) * 2, 2);``` EDIT: more Code: ```public static String getNoteName(int noteNumber){ noteNumber -= 21; // see the explanation below. String[] notes = new String[] {"A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"}; int octave = noteNumber / 12 + 1; String name = notes[noteNumber % 12]; return name + octave; }``` Explanation: A0 in midi is the first note and its number is 21. We adjust the index to start from 0 (hence noteNumber -= 21; at the beginning). If your note numbers are 0 based, for example in piano from 0 to 88, then you can comment this line out. Note that in this solution, the note names in the array start from A to G. Octave is noteNumber / 12 + 1 (Or ceiling of num / 12). Note name index is noteNumber % 12. __________________ ReaTrakStudio Chord Track for Reaper forum www.reatrak.com Last edited by MusoBob; 06-06-2019 at 01:00 PM.

 Thread Tools Display Modes Linear Mode

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home General Discussion     General Discussion (aka spam trap) REAPER Forums     REAPER General Discussion Forum     newbieland     REAPER Q&A, Tips, Tricks and Howto     Recording Technologies and Techniques     REAPER Compatibility     REAPER Color Themes and Icon Sets     MIDI Hardware, Control Surfaces, and OSC     REAPER Non-English Speaking User Forums         Forum de REAPER en français         Foro de REAPER en Español         Fórum do REAPER em português         Forum di REAPER in italiano         Deutschsprachiges REAPER Userforum         Pyccкоязычный фopyм REAPER     REAPER Bug Reports     REAPER Feature Requests     Dstruct's Casa De Nitpicks     REAPER for Live Use     REAPER for Video Editing/Mangling     REAPER for Ambisonic and 3D positional audio uses     ReaScript, JSFX, REAPER Plug-in Extensions, Developer Forum     REAPER for macOS X     REAPER for Linux     REAPER Pre-Release Discussion     REAPER Music/Collaboration Discussion     REAPER lounge NINJAM Discussion     NINJAM User Discussion     NINJAM Developer Discussion Other Software Discussion     WDL users forum     LICEcap Discussion     OSCII-bot forum     Old Cockos Products Forum

All times are GMT -7. The time now is 03:53 AM.

 -- Cockos ---- REAPER 5 ---- Reaper 3 ---- Reaper 2 ---- Reaper 1 Contact Us - Çockos Incorporated - Archive - Top