Old 01-31-2017, 02:52 PM   #1
me2beats
Human being with feelings
 
me2beats's Avatar
 
Join Date: Jul 2015
Location: Yekaterinburg, Russia
Posts: 400
Default Get midi notes names

How to get midi take notes names information?
I saw track chunk and sometimes it has such info but sometimes hasn't.
me2beats is offline   Reply With Quote
Old 01-31-2017, 04:24 PM   #2
Lokasenna
Human being with feelings
 
Lokasenna's Avatar
 
Join Date: Sep 2008
Location: Calgary, AB, Canada
Posts: 6,551
Default

In Lua you can do this:
Code:
-- Returns the track number of the currently-opened MIDI item
function GetCurTrack()

	-- Get the current track number
	cur_editor = reaper.MIDIEditor_GetActive()
	cur_take = reaper.MIDIEditor_GetTake(cur_editor)
	cur_item = reaper.GetMediaItemTake_Item(cur_take)
	cur_track = reaper.GetMediaItemTrack(cur_item)
	cur_track_num = reaper.GetMediaTrackInfo_Value(cur_track, "IP_TRACKNUMBER")
	cur_track_num = math.floor(cur_track_num) - 1
	
	return cur_track_num

end


-- Reads the current note names and returns them as an array
function GetMIDIMap()

	chan = 1
	notemap_arr = {}
	
	cur_track_num = GetCurTrack()
	
	for i = 0, 127 do
		-- string reaper.GetTrackMIDINoteName(integer track, integer note, integer chan)
		notemap_arr[i] = reaper.GetTrackMIDINoteName(cur_track_num, i, chan)
	end

	return notemap_arr
	
end
(old code, there might be a more efficient way to do it)
__________________
I'm no longer using Reaper or working on scripts for it. Sorry. :(
Default 5.0 Nitpicky Edition / GUI library for Lua scripts / Theory Helper / Radial Menu / Donate
Lokasenna is offline   Reply With Quote
Old 02-01-2017, 12:15 PM   #3
me2beats
Human being with feelings
 
me2beats's Avatar
 
Join Date: Jul 2015
Location: Yekaterinburg, Russia
Posts: 400
Default

This works!! Many thanks Lokasenna
me2beats is offline   Reply With Quote
Reply

Thread Tools
Display Modes

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 Jump


All times are GMT -7. The time now is 01:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.