If you can get the timing of notes numerically with REAPER I was wondering if it would be possible to visualize it in sync with various sounds. Memo made
GetNoteList.py
RPR_ClearConsole()
outlist = ""
midieditor = RPR_MIDIEditor_GetActive()
take = RPR_MIDIEditor_GetTake( midieditor )
notecntOut = 0
ccevtcntOut = 0
textsyxevtcntOut = 0
( retval, take, notecntOut, ccevtcntOut, textsyxevtcntOut ) = RPR_MIDI_CountEvts(take, notecntOut, ccevtcntOut, textsyxevtcntOut )
for noteidx in range(notecntOut):
selectedOut = True
mutedOut = True
startppqposOut = 0
endppqposOut = 0
chanOut = 0
pitchOut = 0
velOut = 0
( retval, take, noteidx, selectedOut, mutedOut, startppqposOut, endppqposOut, chanOut, pitchOut, velOut ) = RPR_MIDI_GetNote(take, noteidx, selectedOut, mutedOut, startppqposOut, endppqposOut, chanOut, pitchOut, velOut )
outlist += str(pitchOut) + "," + str(startppqposOut) + "," + str(endppqposOut) + "\n"
#RPR_ShowMessageBox("End", "status", 0 )
RPR_ShowConsoleMsg(outlist)
When you do this
Like this, you can get the note number and note-on / note-off timing information in text.
TIPS --Select the target MIDI Editor (MIDI region) and execute it. --If you want to know the time from the beginning, execute the regions together. ――Doesn't it work if you change the tempo on the way?
quarter note count (QN)
QN is a 1/4 note count, one bar is 4 beats, and it seems to be a count that represents 1 beat. It's like one beat at 960.
start = RPR_TimeMap_QNToTime( startppqposOut)
end = RPR_TimeMap_QNToTime( endppqposOut)
I wonder if this does not support tempo changes ...
Postscript If this is a millisecond, it seems that dividing by 1000 will be a second, but for some reason 960 is a good value? ** * Yokuwakaran **
start = RPR_TimeMap_QNToTime_abs(0, startppqposOut)
end = RPR_TimeMap_QNToTime_abs(0, endppqposOut)
It is written in the reference, but I can not take it well ... ** * So extend the range of the editor to the beginning **
start = RPR_TimeMap2_QNToTime(0, startppqposOut)
end = RPR_TimeMap2_QNToTime(0, endppqposOut)
Is this newer ... I don't really understand the difference. This also seems to be incompatible with tempo changes on the way.
If it was long data, the log amount of the console was exceeded. I wish I could copy the text for the time being
import pyperclip
#Abbreviation
pyperclip.copy(outlist)
Well, it feels reasonable to output to a file.
Recommended Posts