Old 01-20-2017, 06:43 AM   #1
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
Default 1st Selected track - MIDI-learned parameters ?

From an EEL or Lua script, I'd like to know
  1. what parameters of the currently selected track are MIDI-learned

  2. what MIDI-controls they are currently MIDI-learned to (channel,cc/note)

  3. how to most efficiently get their names and values(I'll reconfigure LED ring displays depending on the name)

  4. normalize the value to a [0-127] number and send that out to my controllers.


The first one in particular is the one I know nothing about. The rest I may be able to figure out on my own, though pointers are of course always welcome.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 01-20-2017, 08:01 AM   #2
Nantho
Human being with feelings
 
Join Date: Mar 2013
Posts: 213
Default

Hi Airon !

First of all, let me tell you that I'm following every step forward you make 'cause I also have a MIDI FIghter Twister unit and I dream about MIDI feedback

I'm currently busy working on another kind of script and I thought I would take a look into this after that. So in a nutshell, thank you for doing this

I don't know if it can help you but there is this script from mpl that may suit one of your needs :

mpl_List all MIDI OSC learn from focused fx.lua
Nantho is offline   Reply With Quote
Old 01-20-2017, 08:16 AM   #3
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

Or another script which parse RPP directly:
mpl_List all MIDI OSC learn for current project.lua
mpl is offline   Reply With Quote
Old 01-20-2017, 04:22 PM   #4
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
Default

Thanks gentlemen.

That should be helpful.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 01-21-2017, 03:18 AM   #5
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
Default

Hehe. The console can't display as much data, so I wrote the scripts output to a file instead.

In a recent mix, I had 996 midi-learned controls. The resulting text file is 84 kB in size.

Very helpful indeed. MPL, thank you.

I'm getting some midi CC values beyond 127.

For example, I have an midi-learn in the project that is:
MIDI Chan 16 CC 7
which always shows up in the report as
MIDI ch 0 / MIDI CC 775
(in all tracks since they're mostly setup the same way)

Another is
MIDI Chan 16 CC 6
which shows up in the report as
MIDI ch 0 / MIDI CC 774
Both controls are in
  • CC mode Relative 3
  • Enabled only when track or item is selected
  • armed

Maybe something changed in the format of the project ?

Line 41 onwards of the orignal script grabs that data:
Code:
if ssv[3] ~= 0 then 
midiChannel = 1+ ssv[3] & 0x0F
midiCC = ssv[3] >> 8
end

The code I added to the script, and the modified main function:
Code:
function write_file(ret_str)
   local path_separator = "\\"
   if reaper.GetOS() ~= "Win32" and reaper.GetOS() ~= "Win64" then
       path_separator = "/"
   end
   retval, project_name = reaper.EnumProjects(-1, "", 512) -- get project file name, up to 512 characters
   local project_name = string.gsub (project_name, ".rpp", "") -- remove project extension
         project_name = string.gsub (project_name, ".RPP", "")
   local pattern = ".+" .. path_separator .. "(.+)$" -- get rid of path before project name
   local project_name = project_name:match(pattern)
   local script_path = get_script_path()
   local project_path = get_project_path()
   local time = string.gsub(reaper.format_timestr_pos(reaper.time_precise(), "", 5),":","-") -- get current time, convert to SMPTE and sub ":" for "-"
   filename = project_path .. path_separator .. project_name .. "_" .. time .. ".txt"
   ---- Write to file ----
   file = io.open(filename,"w+")
   file:write(ret_str)
   file:close()
 end

 function get_script_path()
   if reaper.GetOS() == "Win32" or reaper.GetOS() == "Win64" then
     return debug.getinfo(1,'S').source:match("(.*".."\\"..")"):sub(2) -- remove "@"
   end
     return debug.getinfo(1,'S').source:match("(.*".."/"..")"):sub(2)
 end

 function get_project_path()
 --  if reaper.GetOS() == "Win32" or reaper.GetOS() == "Win64" then
     return reaper.GetProjectPath("") --.source:match("(.*".."\\"..")"):sub(2) -- remove "@"
 --  end
 --    return reaper.GetProjectPath("").source:match("(.*".."/"..")"):sub(2)
 end

 function main()
    local t_content = GetContent_t()
    local LRN_t = GetLearn_t(t_content)
    local guid_t = CollectProject_GUIDs()  
    local ret_str = ParseLearnTable(LRN_t, guid_t)
    
    if not ret_str or ret_str == '' then ret_str = 'Nothing linked. \nIf it is not, try to save project before running script.' end
          
    reaper.ClearConsole()
    --reaper.ShowConsoleMsg(ret_str)
    write_file(ret_str)
    reaper.ShowConsoleMsg("File written to \n"..filename.."\n")
  end
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom

Last edited by airon; 01-21-2017 at 03:46 AM.
airon is offline   Reply With Quote
Old 01-21-2017, 03:55 AM   #6
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
Default

Some more info.

The relevant two PARAMLEAN lines in the project are:

PARMLEARN 3 198591 1
PARMLEARN 4 4031 1

So from this:
  • MIDI Chan 16 CC 7 (Relative3, Track, Armed) and
  • MIDI Chan 16 CC 15 (Absolute, Track, Armed)

the script report shows:
  • MIDI ch 0 / MIDI CC 775 and
  • MIDI ch 0 / MIDI CC 15
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 01-21-2017, 05:37 AM   #7
mpl
Human being with feelings
 
mpl's Avatar
 
Join Date: Oct 2013
Location: Moscow, Russia
Posts: 3,984
Default

hmm
Code:
midiChannel = 1+ (ssv[3] & 0x0F)
midiCC = ssv[3] >> 8 & 0x0F
should works (not sure)

Last edited by mpl; 01-21-2017 at 06:03 AM.
mpl is offline   Reply With Quote
Old 01-21-2017, 08:03 AM   #8
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 12,107
Default

Can't help, sorry but watching this thread with interest.

Are we close to generic MIDI feedback for learned parameters ?
Airon, is that what you're trying to do ?
nofish is offline   Reply With Quote
Old 01-21-2017, 09:59 AM   #9
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
Default

I'm exploring what's possible in a very simple manner. My coding capabilities are not comparable to those of other folks here, so I'm looking to find out how hard it could be.

Cockos probably does not have the time to study the problem and develop solutions. They're just two guys and have plenty of stuff to do.

So, Geoff Waddington is exploring OSC communication with an iPad app at this time. I'd like to get generic midi feedback going, if possible. So I'm slowly exploring what it would take to do that.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon is offline   Reply With Quote
Old 01-23-2017, 06:55 AM   #10
airon
Human being with feelings
 
airon's Avatar
 
Join Date: Aug 2006
Location: Berlin
Posts: 11,818
Default

MPL,
I tested the updated version of your script with a session I saved with v5.33pre2. All looks good now.

Thanks for any fix you may have done. The script routines should help with any project dealing with midi/osc-learned controls.
__________________
Using Latch Preview (Video) - Faderport 16 setup for CSI 1.1 , CSI 3.10
Website
"My ego comes pre-shrunk" - Randy Thom
airon 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 03:45 AM.


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