Old 11-03-2019, 09:32 AM   #1881
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

@timbralzoom

This is not exactly what you requested, but can still be useful when working on hundreds or thousands of MIDI items:

Transpose selected MIDI items (all takes) to target octave
  • It transposes selected MIDI takes by octaves, so that the lowest note lands on that certain (user defined) octave
  • You can edit the last line to set the target octave



Code:
function get_notes_and_range(take)
  local MIDI_notes = {}
  local note_min, note_max = 127, 0
  local retval, note_cnt = reaper.MIDI_CountEvts(take)
  for n=1, note_cnt do
    local ret, selected, muted, startppqpos, endppqpos, chan, pitch, vel = reaper.MIDI_GetNote(take, n-1)
    MIDI_notes[#MIDI_notes+1] = {selected, muted, startppqpos, endppqpos, chan, pitch, vel}
    if pitch < note_min then note_min = pitch end
    if pitch > note_max then note_max = pitch end
  end
  return MIDI_notes, note_min, note_max
end


function transpose_to_octave(octave) -- octave 4 is middle C
  octave = octave + 1
  local item_cnt = reaper.CountSelectedMediaItems(0)
  for i=1, item_cnt do
    local item = reaper.GetSelectedMediaItem(0, i-1)
    if item then
      local take_count = reaper.GetMediaItemNumTakes(item)
      for t=1, take_count do
        local take = reaper.GetMediaItemTake(item, t-1)
        if take and reaper.TakeIsMIDI(take) then
          local note_tbl, note_min, note_max = get_notes_and_range(take)
          local note_min_transposed = note_min % 12 + octave*12
          local pitch_diff = note_min_transposed - note_min     
          for noteidx=1, #note_tbl do
            local n = note_tbl[noteidx]
            --boolean reaper.MIDI_SetNote(MediaItem_Take take, integer noteidx, optional boolean selectedIn, optional boolean mutedIn, optional number startppqposIn, optional number endppqposIn, optional number chanIn, optional number pitchIn, optional number velIn, optional boolean noSortIn)
            reaper.MIDI_SetNote(take, noteidx-1, n[1], n[2], n[3], n[4], n[5], n[6]+pitch_diff, n[7], false)
          end
        end
      end
    end
  end
  reaper.Undo_OnStateChange("Transpose")
end

transpose_to_octave(4) -- 4 is middle C (5 = middle C + 1 octave etc.)
spk77 is offline   Reply With Quote
Old 11-03-2019, 01:35 PM   #1882
timbralzoom
Human being with feelings
 
timbralzoom's Avatar
 
Join Date: Apr 2010
Location: Turkey/Istanbul
Posts: 1,820
Default

Quote:
Originally Posted by MusoBob View Post
That should be easy enough to make but I think there may already be something that will do that. Try in Reapack.
Thank you!
i checked everything i found "Transpose" related .. didn't work.



Quote:
Originally Posted by spk77 View Post
@timbralzoom

This is not exactly what you requested, but can still be useful when working on hundreds or thousands of MIDI items:

Transpose selected MIDI items (all takes) to target octave
  • It transposes selected MIDI takes by octaves, so that the lowest note lands on that certain (user defined) octave
  • You can edit the last line to set the target octave



Code:
function get_notes_and_range(take)
  local MIDI_notes = {}
  local note_min, note_max = 127, 0
  local retval, note_cnt = reaper.MIDI_CountEvts(take)
  for n=1, note_cnt do
    local ret, selected, muted, startppqpos, endppqpos, chan, pitch, vel = reaper.MIDI_GetNote(take, n-1)
    MIDI_notes[#MIDI_notes+1] = {selected, muted, startppqpos, endppqpos, chan, pitch, vel}
    if pitch < note_min then note_min = pitch end
    if pitch > note_max then note_max = pitch end
  end
  return MIDI_notes, note_min, note_max
end


function transpose_to_octave(octave) -- octave 4 is middle C
  octave = octave + 1
  local item_cnt = reaper.CountSelectedMediaItems(0)
  for i=1, item_cnt do
    local item = reaper.GetSelectedMediaItem(0, i-1)
    if item then
      local take_count = reaper.GetMediaItemNumTakes(item)
      for t=1, take_count do
        local take = reaper.GetMediaItemTake(item, t-1)
        if take and reaper.TakeIsMIDI(take) then
          local note_tbl, note_min, note_max = get_notes_and_range(take)
          local note_min_transposed = note_min % 12 + octave*12
          local pitch_diff = note_min_transposed - note_min     
          for noteidx=1, #note_tbl do
            local n = note_tbl[noteidx]
            --boolean reaper.MIDI_SetNote(MediaItem_Take take, integer noteidx, optional boolean selectedIn, optional boolean mutedIn, optional number startppqposIn, optional number endppqposIn, optional number chanIn, optional number pitchIn, optional number velIn, optional boolean noSortIn)
            reaper.MIDI_SetNote(take, noteidx-1, n[1], n[2], n[3], n[4], n[5], n[6]+pitch_diff, n[7], false)
          end
        end
      end
    end
  end
  reaper.Undo_OnStateChange("Transpose")
end

transpose_to_octave(4) -- 4 is middle C (5 = middle C + 1 octave etc.)

This is exactly does what i was trying to describe!
not in the Midi Editor,
but even better in the Arrangement with the Takes!

Thank you so much!
now i need an email address of yours to send a humble Amazon eGift card .. please PM me.
(paypal still doesn't work here/Turkey)



timbralzoom is offline   Reply With Quote
Old 11-04-2019, 12:59 PM   #1883
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by timbralzoom View Post
Thank you so much!
now i need an email address of yours to send a humble Amazon eGift card .. please PM me.
(paypal still doesn't work here/Turkey)
Thanks! PM sent.

My pm box has been full for ages...just removed all old messages.
I was inactive for a year and a half, so apologies to those who didn't get any reply!
spk77 is offline   Reply With Quote
Old 11-04-2019, 02:20 PM   #1884
timbralzoom
Human being with feelings
 
timbralzoom's Avatar
 
Join Date: Apr 2010
Location: Turkey/Istanbul
Posts: 1,820
Default

Quote:
Originally Posted by spk77 View Post
Thanks! PM sent.

My pm box has been full for ages...just removed all old messages.
I was inactive for a year and a half, so apologies to those who didn't get any reply!
i am not using a broom avatar for nothing

joking apart, script is a huge time saver to me,

Thanks a lot !
timbralzoom is offline   Reply With Quote
Old 11-04-2019, 02:29 PM   #1885
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by timbralzoom View Post
i am not using a broom avatar for nothing

joking apart, script is a huge time saver to me,

Thanks a lot !
Glad it worked and thanks for the gift card!
spk77 is offline   Reply With Quote
Old 11-05-2019, 08:16 AM   #1886
Vagelis
Human being with feelings
 
Vagelis's Avatar
 
Join Date: Oct 2017
Location: Larisa, Greece
Posts: 3,795
Default

Hi! I'd like to ask if someone could make a script that duplicates selected items or AI at mouse position but to snap the start of the duplicated item at the end of the previous item and the opposite to snap the end of the duplicated item at the start of the next item?
Here's a gif that shows how it is done in FL:
https://imgur.com/NaKJC0Y

The advantage of FL way compared to Reaper(Draw copy), is that you can change the length of each duplication from their edge.
Is there a script that could split the looped items, to the area shown in the next pic, so we could do the same in Reaper?

Vagelis is offline   Reply With Quote
Old 11-10-2019, 12:58 AM   #1887
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default Smart tool assigned to keystroke?

I've created several buttons and I can turn them into 'Smart Tools' via a right click on the mouse.

But what I'm trying to figure out now to do is have a keystroke trigger the smart tool.

So far, I haven't been able to find anything in the documentation that describes how to do this?

To explain further... I have a button that I can turn into a smart tool.

I want to assign a keystroke that will trigger that button as a smart tool (not just trigger the button)

Any help would be greatly appreciated.

Thank you!
LarrySeyer is offline   Reply With Quote
Old 11-10-2019, 05:37 AM   #1888
timbralzoom
Human being with feelings
 
timbralzoom's Avatar
 
Join Date: Apr 2010
Location: Turkey/Istanbul
Posts: 1,820
Default

is this possible:

Item: Extend last note length to the end of the item?
for filling the end gap with the last note's length

i hope image explains a bit better

timbralzoom is offline   Reply With Quote
Old 11-10-2019, 07:40 AM   #1889
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 3,913
Default

Quote:
Originally Posted by LarrySeyer View Post
I've created several buttons and I can turn them into 'Smart Tools' via a right click on the mouse.

But what I'm trying to figure out now to do is have a keystroke trigger the smart tool.
You can do that using custom actions.
Create a new custom action, give it a name, e.g., Arm MyScript.
Add action "Action: Arm next action".
Add your script: MyScript.
Click OK.
Set a shortcut key to the new custom action.
Edgemeal is offline   Reply With Quote
Old 11-10-2019, 09:19 AM   #1890
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by Edgemeal View Post
You can do that using custom actions.
Create a new custom action, give it a name, e.g., Arm MyScript.
Add action "Action: Arm next action".
Add your script: MyScript.
Click OK.
Set a shortcut key to the new custom action.
Thank you for attempting to help but I don’t think that will do what I’m trying to do.

I need to Trigger a particular button into smart tool mode. Not arm a “next” button since there are several buttons and several keystrokes that need this function - all of them different. So a “next” feature will not work.

Any other suggestions?

L

Last edited by LarrySeyer; 11-10-2019 at 09:44 AM.
LarrySeyer is offline   Reply With Quote
Old 11-10-2019, 11:10 AM   #1891
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

Quote:
Originally Posted by LarrySeyer View Post
Thank you for attempting to help but I don’t think that will do what I’m trying to do.

I need to Trigger a particular button into smart tool mode. Not arm a “next” button since there are several buttons and several keystrokes that need this function - all of them different. So a “next” feature will not work.

Any other suggestions?

L
This seems to work, but you have to create a copy of this script (with different "action_id_str") for each of your buttons:

Code:
local action_id_str = "_RSbfc5312090ba047544b89a315793ce5754c95bdd" -- Copy/paste this Command ID from the action list
local sectionname = "" -- empty string for main section actions

local action = reaper.NamedCommandLookup(action_id_str)
local retval, sec = reaper.GetArmedCommand()
if retval == action and sec == sectionname then
  action = 0 -- disarm
end

reaper.ArmCommand(action, sectionname)
reaper.defer(function() end) -- no undo point
spk77 is offline   Reply With Quote
Old 11-10-2019, 11:19 AM   #1892
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by spk77 View Post
This seems to work, but you have to create a copy of this script (with different "action_id_str") for each of your buttons:

Code:
local action_id_str = "_RSbfc5312090ba047544b89a315793ce5754c95bdd" -- Copy/paste this Command ID from the action list
local sectionname = "" -- empty string for main section actions

local action = reaper.NamedCommandLookup(action_id_str)
local retval, sec = reaper.GetArmedCommand()
if retval == action and sec == sectionname then
  action = 0 -- disarm
end

reaper.ArmCommand(action, sectionname)
reaper.defer(function() end) -- no undo point
That works perfectly! Thank you!

BTW, what theme are you using? It looks awesome!

L
LarrySeyer is offline   Reply With Quote
Old 11-10-2019, 11:23 AM   #1893
spk77
Human being with feelings
 
Join Date: Aug 2012
Location: Finland
Posts: 2,668
Default

@LarrySeyer

Glad it works!
The theme is "Default 5 Dark Extended": https://forum.cockos.com/showthread.php?t=172024
spk77 is offline   Reply With Quote
Old 11-13-2019, 11:10 AM   #1894
free2worship
Human being with feelings
 
Join Date: Jul 2018
Posts: 4
Default SWS Extensions Update for MacOS 10.15.1 (Catalina)

Does anyone know the ETA for an update that will work with Mac OS Catalina? I did the Mac upgrade and SWS-Extensions are non functioning as is also the latest version of Reaper. I had to downgrade back to MacOS 10.14.6.

Thanks for any feedback. I didn't find any info at sws-extension.org.
free2worship is offline   Reply With Quote
Old 11-13-2019, 11:16 AM   #1895
solger
Human being with feelings
 
solger's Avatar
 
Join Date: Mar 2013
Posts: 5,844
Default

Quote:
Originally Posted by free2worship View Post
Does anyone know the ETA for an update that will work with Mac OS Catalina? I did the Mac upgrade and SWS-Extensions are non functioning as is also the latest version of Reaper. I had to downgrade back to MacOS 10.14.6.

Thanks for any feedback. I didn't find any info at sws-extension.org.
Have a look at this thread (post #8 and #10): https://forum.cockos.com/showthread.php?t=226059
__________________
ReaLauncher
solger is offline   Reply With Quote
Old 11-15-2019, 10:06 AM   #1896
Triode
Human being with feelings
 
Triode's Avatar
 
Join Date: Jan 2012
Posts: 1,180
Default

Hi Folks

Is it possible to script an action that starts playback from the left hand visible edge of the currently focussed midi editor window?

Many thanks for any tips
__________________
Mixing / Brush and Beater Drums Online: www.outoftheboxsounds.com
Triode is online now   Reply With Quote
Old 11-21-2019, 03:33 PM   #1897
b0se
Human being with feelings
 
b0se's Avatar
 
Join Date: Jan 2019
Location: UK
Posts: 938
Default

Hey there!

As my Render To File is bugging out, I'm needing to loop through my hardware chain via track sends/receives.

Could someone help me with a simple script that:

1) Sets the current/selected track Audio Hardware Output to: Output 3 / Output 4 and disables Parent Send
2) Creates a new track using '$track-print' as the name, volume at 0dB, Armed, Monitoring On and Input:Stereo (Input 3 / Input 4).

Happy to donate via PayPal as this would be a big time saver!
b0se is offline   Reply With Quote
Old 11-22-2019, 06:03 AM   #1898
b0se
Human being with feelings
 
b0se's Avatar
 
Join Date: Jan 2019
Location: UK
Posts: 938
Default

Quote:
Originally Posted by b0se View Post
Hey there!

As my Render To File is bugging out, I'm needing to loop through my hardware chain via track sends/receives.

Could someone help me with a simple script that:

1) Sets the current/selected track Audio Hardware Output to: Output 3 / Output 4 and disables Parent Send
2) Creates a new track using '$track-print' as the name, volume at 0dB, Armed, Monitoring On and Input:Stereo (Input 3 / Input 4).

Happy to donate via PayPal as this would be a big time saver!
Never mind, dipped the proverbial toes into scripting and done it. Works a treat.

Code:
-- get selected track ID, add FX, disable parent send
trackCurrent = reaper.GetSelectedTrack(0,0)
val,trackName = reaper.GetTrackName(trackCurrent)
reaper.TrackFX_AddByName(trackCurrent, "VST:NotJustAnotherDither", 0, 1 )
reaper.SetMediaTrackInfo_Value(trackCurrent, "B_MAINSEND", 0) 

-- set 3/4 HW output
_, chunk = reaper.GetTrackStateChunk(trackCurrent, '')
chunk = chunk:gsub('MAINSEND','HWOUT 2 0 1 0 0 0 0 -1:U -1\nMAINSEND')
reaper.SetTrackStateChunk(trackCurrent, chunk, false)

-- unarm all tracks
total_tracks = reaper.CountTracks(0)

for i = 0, total_tracks-1 do
 track = reaper.GetTrack(0,i)
 if reaper.GetMediaTrackInfo_Value(track, "I_RECARM") == 1 then
   reaper.SetMediaTrackInfo_Value(track, "I_RECARM", 0)
 end
end

-- Cload template and rename
reaper.Main_openProject("/Volumes/SSD/Reaper/KEEP/SBOUT.RTrackTemplate")
trackCurrent = reaper.GetSelectedTrack(0,0)
reaper.GetSetMediaTrackInfo_String(trackCurrent, "P_NAME", trackName..'-SB', true)
Found the HWOUT string via this script mentioned here:

https://forum.cockos.com/showpost.ph...&postcount=659

Also unarms all other tracks as to only record via HW loop, and adds Airwindows NJAD (dither) before hitting the hardware.
b0se is offline   Reply With Quote
Old 12-03-2019, 06:04 AM   #1899
Bertrand H
Human being with feelings
 
Join Date: Feb 2018
Location: Belgium
Posts: 7
Default

Quote:
Originally Posted by spk77 View Post
Thanks, it worked!

(I still had to use parameter modulation (for testing): If I move a slider on the ReaControlMIDI, it becomes "last focused FX" and the script doesn't work )



Here's the first attempt:

Lua - Adjust wet parameter of floating and focused track FX.
Code:
function msg(m)
  return reaper.ShowConsoleMsg(tostring(m) .. "\n")
end

function adjust_wet_param()
  local is_new_value, filename, sectionID, cmdID,mode, resolution, val = reaper.get_action_context()
  local retval, track_number, item_number, fx_number = reaper.GetFocusedFX()
  if retval == 1 and item_number == -1 then -- this script works only on track FXs
    local track = reaper.CSurf_TrackFromID(track_number, false)
    local is_open = reaper.TrackFX_GetOpen(track, fx_number)
    if not is_open then
      return
    end
    for i=1, reaper.TrackFX_GetNumParams(track, fx_number) do
      local ret, param_name = reaper.TrackFX_GetParamName(track, fx_number, i-1, "")
      --msg(param_name)
      if param_name == "Wet" then
        --msg(val/127)
        reaper.TrackFX_SetParam(track, fx_number, i-1, val/127)
        break
      end
    end
  end
end

reaper.defer(adjust_wet_param)
Thats very nice thank you!!! Now I have a button in absolute mode and it toggle between 0 and 100% of a selected FX without glitches. Is it a way I could use this script in order to toggle 0%-100% simultaneously on evrey fxs of the selected tracks? Regards, B
Bertrand H is offline   Reply With Quote
Old 12-11-2019, 08:00 PM   #1900
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default Wait for MIDI event to record

In Digital Performer, you can set the transport to wait to start recording for a MIDI note to be played before it starts recording.

I'd like to have a script that would do that.
LarrySeyer is offline   Reply With Quote
Old 12-11-2019, 08:23 PM   #1901
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

See if this helps
Recording started/trigged by MIDI signal?

You could make one, I have a region chord player that works from midi input, you can set keyswitches to do different things.
https://forums.cockos.com/showthread...69#post2207169
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-11-2019, 08:46 PM   #1902
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by MusoBob View Post
See if this helps
Recording started/trigged by MIDI signal?

You could make one, I have a region chord player that works from midi input, you can set keyswitches to do different things.
https://forums.cockos.com/showthread...69#post2207169
Thank you but I don’t think that will do what I’m trying to do.

I wanted to start recording if I play ANY note on the midi keyboard. I don’t want to have to press a particular note to start recording. When you’re recording a solo piano via MIDI, many times you break up the recording into smaller parts. You set your cursor where you want the next part of the piano part to go and the machine will wait until you start playing to record. Once you start playing the midi part, it goes into record and places the notes that you play in their proper positions.
LarrySeyer is offline   Reply With Quote
Old 12-12-2019, 01:20 AM   #1903
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

That just uses a JS Midi FX and reaper.TrackFX_GetParam
you could set it to any note/s input to start recording so if the parameter input > -1 (0-127) then record.

But I'm sure someone would of worked out a way to do it by now.
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-12-2019, 12:46 PM   #1904
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default Wait for MIDI note to record

Quote:
Originally Posted by MusoBob View Post
That just uses a JS Midi FX and reaper.TrackFX_GetParam
you could set it to any note/s input to start recording so if the parameter input > -1 (0-127) then record.

But I'm sure someone would of worked out a way to do it by now.
That’s a little above my pay grade (smiles)

Anyone else have a script that will do this? Or something I can understand as an example for me to work from?
LarrySeyer is offline   Reply With Quote
Old 12-12-2019, 02:02 PM   #1905
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

This will work but it won't catch the first note so you may have to hit any note to start record first.
I will think more about that, though someone else may have a solution.
Put this in the first track set it to record and monitor midi input and select that track.
https://stash.reaper.fm/v/37404/note-counter.jsfx

midi input start record.lua

Install Lokasenna GUI from ReaPack then run
Set Lokasenna_GUI v2 library path.lua
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-12-2019, 09:27 PM   #1906
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default Wait for MIDI note to start recording.

Quote:
Originally Posted by MusoBob View Post
This will work but it won't catch the first note so you may have to hit any note to start record first.
I will think more about that, though someone else may have a solution.
Put this in the first track set it to record and monitor midi input and select that track.
https://stash.reaper.fm/v/37404/note-counter.jsfx

midi input start record.lua

Install Lokasenna GUI from ReaPack then run
Set Lokasenna_GUI v2 library path.lua
Thank you!

I’ll give this a try.

All the best to you.

Larry
LarrySeyer is offline   Reply With Quote
Old 12-13-2019, 06:34 PM   #1907
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default Wait for MIDI event to record

Quote:
Originally Posted by MusoBob View Post
This will work but it won't catch the first note so you may have to hit any note to start record first.
I will think more about that, though someone else may have a solution.
Put this in the first track set it to record and monitor midi input and select that track.
https://stash.reaper.fm/v/37404/note-counter.jsfx

midi input start record.lua

Install Lokasenna GUI from ReaPack then run
Set Lokasenna_GUI v2 library path.lua
OK, I've been experimenting with this script.

It seems to work except for one thing... as soon as the script is run, the transport starts.

I'm trying to get it to not start the transport until a MIDI note is played... but I'm not having any success.

Any ideas?
LarrySeyer is offline   Reply With Quote
Old 12-13-2019, 08:30 PM   #1908
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

If you click Edit > Script: midi input start record.lua
Ctrl+F then Ctrl+V > if notes_in_num > -1 > Enter
now put this in Msg("notes_in_num "..notes_in_num)
that will show you what note is triggering the record.
Code:
  if notes_in_num > -1 and play_state == 0 then
    Msg("notes_in_num "..notes_in_num)
    reaper.Main_OnCommand(1013, 0) -- Transport: Record
    
    
  end
the script is reading "lowest note" parameter in the JS Midi

__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-13-2019, 08:42 PM   #1909
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by MusoBob View Post
If you click Edit > Script: midi input start record.lua
Ctrl+F then Ctrl+V > if notes_in_num > -1 > Enter
now put this in Msg("notes_in_num "..notes_in_num)
that will show you what note is triggering the record.
Code:
  if notes_in_num > -1 and play_state == 0 then
    Msg("notes_in_num "..notes_in_num)
    reaper.Main_OnCommand(1013, 0) -- Transport: Record
    
    
  end
the script is reading "lowest note" parameter in the JS Midi


Ok. Thanks for that.

It appears to be triggering from 0

L
LarrySeyer is offline   Reply With Quote
Old 12-13-2019, 08:45 PM   #1910
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

try change it to
Code:
if notes_in_num > 0 and play_state == 0 then
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-13-2019, 11:43 PM   #1911
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by MusoBob View Post
try change it to
Code:
if notes_in_num > 0 and play_state == 0 then
When I do that, it doesn't start at all.

I must be missing something here...

When checking the value of notes_in_num, it is ALWAYS 0.

Seems like that should change when I play a MIDI note, correct?

In it's simplest form it is:

Code:
function watchJsfx()
	  play_state = reaper.GetPlayState()
	  seltrack = reaper.GetTrack( 0, 0 )
	  notes_in = reaper.TrackFX_GetParam(seltrack, 0, 12)
	  notes_in_num = tonumber(round2(notes_in))
	--
	if notes_in_num > 0 and play_state == 0 then
		reaper.Main_OnCommand(1013, 0) -- Transport: Record
	end
end
But notes_in_num is ALWAYS zero... that doesn't seem right.

I can record onto that track using my MIDI keyboard just fine... no issues.

L
LarrySeyer is offline   Reply With Quote
Old 12-13-2019, 11:58 PM   #1912
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Are any of the sliders changing in the JS note counter ?
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-14-2019, 12:25 AM   #1913
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by MusoBob View Post
Are any of the sliders changing in the JS note counter ?
I think I may be missing a key component.

You mentioned using "note-counter.jsfx" and putting that on track 1.

However, I can't seem to find anywhere to put that on there. I have the file... I can see it when trying to load it into the actions list. But it's greyed out.

How is that loaded? Input FX?

If so, why is it greyed out when I try to load it?

Sorry to be so dense... but I'm a relative newbee with Reaper.
LarrySeyer is offline   Reply With Quote
Old 12-14-2019, 12:34 AM   #1914
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

Reaper > Options > Show Reaper resource path

put the downloaded note-counter.jsfx into
Effects/MIDI folder
restart Reaper
add FX by clicking the FX button on the track
under JS in the FX browser type note-counter
and add it.
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-14-2019, 12:44 AM   #1915
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by MusoBob View Post
Are any of the sliders changing in the JS note counter ?
Yes. Now I see the .jsfx plugin. Sorry, I didn't load the plugin.

However, that did not fix the problem.

I've tried -1 and 0 in the if statement and neither works.

Currently, the code is:
Code:
function watchJsfx()
  play_state = reaper.GetPlayState()
  seltrack = reaper.GetTrack( 0, 0 )
  notes_in = reaper.TrackFX_GetParam(seltrack, 0, 12 )
  notes_in_num = tonumber(round2(notes_in))
  Msg("notes_in_num "..notes_in_num)
  if notes_in_num > 0 and play_state == 0 then
    reaper.Main_OnCommand(1013, 0) -- Transport: Record
  end    
end
notes_in_num always shows 0

Sorry this is taking so long.

I really appreciate your help. I can see that it works on your system. (nice GIF btw) It just doesn't work on mine for whatever reason.

L
LarrySeyer is offline   Reply With Quote
Old 12-14-2019, 12:45 AM   #1916
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

You could get the lua script to insert the track, the JS MIDI FX, set to record and monitor automatically then you set set the midi input device, though you maybe able to set that also ?
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob is offline   Reply With Quote
Old 12-14-2019, 12:52 AM   #1917
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by MusoBob View Post
You could get the lua script to insert the track, the JS MIDI FX, set to record and monitor automatically then you set set the midi input device, though you maybe able to set that also ?
I'll have to do some research on that... that would be much better for sure.

BTW, I deleted my original track and created a new track and now it works... must have been the old track.

Thank you again for all of your help!

L
LarrySeyer is offline   Reply With Quote
Old 12-14-2019, 12:56 AM   #1918
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by LarrySeyer View Post
I'll have to do some research on that... that would be much better for sure.

BTW, I deleted my original track and created a new track and now it works... must have been the old track.

Thank you again for all of your help!

L
Spoke too soon...

It worked one time... now it doesn't anymore. Geez.

Seems like there should be a Reaper Transport option for this. DP has had it for over 20 years. Surely someone has created a 'wait for MIDI' function for Reaper's transport?

L
LarrySeyer is offline   Reply With Quote
Old 12-14-2019, 01:05 AM   #1919
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Bastrop, Tx
Posts: 169
Default

Quote:
Originally Posted by LarrySeyer View Post
Spoke too soon...

It worked one time... now it doesn't anymore. Geez.

Seems like there should be a Reaper Transport option for this. DP has had it for over 20 years. Surely someone has created a 'wait for MIDI' function for Reaper's transport?

L
Made a video so you can see what I see.

[Video] https://youtu.be/6lxQ3Snj-kg [/Video]
LarrySeyer is offline   Reply With Quote
Old 12-14-2019, 01:08 AM   #1920
MusoBob
Human being with feelings
 
MusoBob's Avatar
 
Join Date: Sep 2014
Posts: 2,643
Default

The region player I made inserts the track and FX, I can just copy the code from that.
If you got it to work once it will work again just needs sorting out, hang in there.
__________________
ReaTrakStudio Chord Track for Reaper forum
www.reatrak.com
STASH Downloads https://stash.reaper.fm/u/ReaTrak
MusoBob 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 06:17 AM.


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