Old 10-27-2019, 10:05 PM   #521
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Qubec, Canada
Posts: 2,892
Default

Is is not necessary. Just type reaper.Main_OnCommand rather than Main_OnCommand.
cfillion is offline   Reply With Quote
Old 10-28-2019, 05:07 AM   #522
Edgemeal
Human being with feelings
 
Edgemeal's Avatar
 
Join Date: Apr 2016
Location: ASU`ogacihC
Posts: 1,529
Default

Quote:
Originally Posted by Zamyen View Post
for key in pairs(reaper) do _G[key]=reaper[key] end
FWIW, thats not recommended,
https://forum.cockos.com/showpost.ph...64&postcount=9
Edgemeal is offline   Reply With Quote
Old 10-31-2019, 01:01 AM   #523
estux
Human being with feelings
 
Join Date: Sep 2018
Posts: 51
Default

How do I clear (reset to default) the color of a track or item in lua?
estux is online now   Reply With Quote
Old 10-31-2019, 02:13 AM   #524
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Qubec, Canada
Posts: 2,892
Default

Clear the 25th bit of I_CUSTOMCOLOR to disable a track or item's custom color.

Code:
local track = reaper.GetTrack(0, 0)
local color = reaper.GetMediaTrackInfo_Value(track, 'I_CUSTOMCOLOR')
color = color & ~(1<<8*3)
reaper.SetMediaTrackInfo_Value(track, 'I_CUSTOMCOLOR', color)
cfillion is offline   Reply With Quote
Old 10-31-2019, 02:33 AM   #525
estux
Human being with feelings
 
Join Date: Sep 2018
Posts: 51
Default

Quote:
Originally Posted by cfillion View Post
Clear the 25th bit of I_CUSTOMCOLOR to disable a track or item's custom color.

Code:
local track = reaper.GetTrack(0, 0)
local color = reaper.GetMediaTrackInfo_Value(track, 'I_CUSTOMCOLOR')
color = color & ~(1<<8*3)
reaper.SetMediaTrackInfo_Value(track, 'I_CUSTOMCOLOR', color)
Awesome, thanks!!
estux is online now   Reply With Quote
Old 10-31-2019, 05:34 PM   #526
Zamyen
Human being with feelings
 
Join Date: Dec 2008
Posts: 58
Default

Quote:
Originally Posted by cfillion View Post
Is is not necessary. Just type reaper.Main_OnCommand rather than Main_OnCommand.
Quote:
Originally Posted by Edgemeal View Post
Thanks a lot for the info and advice, I have managed to remove this from all my scripts as well.
Zamyen is offline   Reply With Quote
Old 10-31-2019, 10:00 PM   #527
IonianStreams
Human being with feelings
 
IonianStreams's Avatar
 
Join Date: May 2019
Location: Front Range Colorado
Posts: 7
Default JS "phase" variable

I recently began looking into phase correlation/cancellation issues. This got me looking into LOSER's "JS Channel Phase Meter" plugin and the JSFX code therein. LOSER uses the variable "phase" in this code. This is clearly a system variable as it is referenced without ever being initialized. And it is obviously some measure of phase correlation. But where is "phase" documented? What exactly does it measure? Why does it vary with his "Check Interval" slider? I don't find anything in the https://www.reaper.fm/sdk/js/js.php documentation on "phase". More generally, where does one find documentation/resources for the audio concepts in JSFX (i.e., beyond just JS syntax and basics)? [Maybe this should be in newbieland forum but I didn't see any JS Qs in there.]
__________________
I understand. At least I think I understand, which is the same thing... I think.
IonianStreams is offline   Reply With Quote
Old 10-31-2019, 10:48 PM   #528
mschnell
Human being with feelings
 
mschnell's Avatar
 
Join Date: Jun 2013
Location: Krefeld, Germany
Posts: 8,213
Default

"phase" is just a normal variable.

It's set to zero and counted up and down.

-Michael
mschnell is online now   Reply With Quote
Old 11-01-2019, 03:53 AM   #529
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,001
Default

Quote:
Originally Posted by IonianStreams View Post
This is clearly a system variable as it is referenced without ever being initialized.
It's not a system variable, it's zeroed in the @block section of the code. The "t" variable is more suspect as it's never zeroed anywhere and is also not a system variable. (Could be Eel/JesuSonic always initializes user variables to zero, though...)
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote
Old 11-01-2019, 10:25 AM   #530
IonianStreams
Human being with feelings
 
IonianStreams's Avatar
 
Join Date: May 2019
Location: Front Range Colorado
Posts: 7
Default JS "phase" variable

Thanks mschnell and Xenakios. You're both absolutely right. This is my first look at JS and I completely missed that phase line in @samples!

In the bigger picture, what I'm after is a phase correlation meter that shows more than just a hyperactive, flickering dot/slider showing the instantaneous phase (and "JS Channel Phase Meter" doesn't even show that, only "IN" and "OUT"). For example, Ozone's free Imager meter shows such a dot that floats between -1 and 1. I find myself watching it and trying to take a mental average of the value over the length of the song section I'm investigating. Why not have the meter compute/display such an average? I've not seen this in any of the JS or free meters out there.

So I programmed something in JS that seems to work. Phase correlation is calculated as done by LOSER and output to a slider at every 1024 samples. The slider mimics the Imager dot pretty well. But the program also calculates a running average of the phase correlation while song is playing, showing it in another slider. Finds the min & max correlation too. Seems to work OK. First, am I missing something in this approach?

Second, I've read that phase is calculated not as 1 or -1 based on sign(spl's) agreement, but as ArcTangent(spl0/spl1). Any comments on this is much appreciated.
__________________
I understand. At least I think I understand, which is the same thing... I think.
IonianStreams is offline   Reply With Quote
Old 11-02-2019, 09:45 AM   #531
IonianStreams
Human being with feelings
 
IonianStreams's Avatar
 
Join Date: May 2019
Location: Front Range Colorado
Posts: 7
Default JS "phase" variable

I found another LOSER JSFX, "JS Stereo Field Manipulator", in which he calculates the phase "angle" using the atan(spl0/spl1) math I was asking about. He uses it to rotate the phase. I guess the best way to learn this stuff is just by studying the experts' code. Climbing the learning curve. It's pretty cool that Reaper offers the ability to program your own fx.
__________________
I understand. At least I think I understand, which is the same thing... I think.
IonianStreams is offline   Reply With Quote
Old 11-06-2019, 09:06 PM   #532
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 869
Default Determine recording MIDI items

Is there a way to efficiently determine the list of MIDI items that are being actively recorded at any given moment?

I say efficiently because I want to do this continuously within a deferred loop given that the target items can actually change over time (e.g. as the play cursor traverses over other MIDI items with MIDI overdub enabled).

Otherwise I'm sure I could figure out how to do it the slow way. (Fetch current play position, enumerate over all tracks, determine which tracks are armed for recording, enumerate MIDI items on each armed track, determine which MIDI items intersect with the play position.) But I'd rather not, because that way is *very* inefficient.
tack is online now   Reply With Quote
Old 11-08-2019, 10:38 AM   #533
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

Quote:
Originally Posted by tack View Post
Is there a way to efficiently determine the list of MIDI items that are being actively recorded at any given moment?

I say efficiently because I want to do this continuously within a deferred loop given that the target items can actually change over time (e.g. as the play cursor traverses over other MIDI items with MIDI overdub enabled).

Otherwise I'm sure I could figure out how to do it the slow way. (Fetch current play position, enumerate over all tracks, determine which tracks are armed for recording, enumerate MIDI items on each armed track, determine which MIDI items intersect with the play position.) But I'd rather not, because that way is *very* inefficient.
You could try to select the items at cursorposition(don't know, if there's an action for that) and just check them, using GetSelectedMediaItem

https://mespotin.uber.space/Ultrasch...ectedMediaItem

This is way faster than checking all MediaItems.
You may need to revert the item-selection after that again.

Edit:
This action could work, you would need to temporarily move the editcursor for that and select all tracks:
_XENAKIOS_SELITEMSUNDEDCURSELTX - Xenakios/SWS: Select items under edit cursor on selected tracks
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-08-2019, 10:43 AM   #534
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 869
Default

Quote:
Originally Posted by mespotine View Post
You could try to select the items at cursorposition(don't know, if there's an action for that)
It's an interesting idea. There's an action to select items under the edit cursor, but alas I don't see one to select items under the play cursor (which is the one that advances during recording).
tack is online now   Reply With Quote
Old 11-08-2019, 10:45 AM   #535
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 869
Default

Quote:
Originally Posted by mespotine View Post
Edit:
This action could work, you would need to temporarily move the editcursor for that and select all tracks:
_XENAKIOS_SELITEMSUNDEDCURSELTX - Xenakios/SWS: Select items under edit cursor on selected tracks
Bearing in mind this would need to be called in each defer execution, I guess I'd have to move the edit cursor, run the action, and move it back, about 30 times a second.

Maybe that's not the end of the world if that honors PreventUIRefresh(). I'll give that a shot. Thanks for the idea!
tack is online now   Reply With Quote
Old 11-08-2019, 10:48 AM   #536
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

It should survive 30 times per second, unless you work with thousands of tracks, according to my experiences.
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-08-2019, 11:11 AM   #537
tack
Human being with feelings
 
tack's Avatar
 
Join Date: Jan 2014
Location: Ontario, Canada
Posts: 869
Default

Quote:
Originally Posted by mespotine View Post
It should survive 30 times per second, unless you work with thousands of tracks, according to my experiences.
Well it was worth a shot, but it wreaks havoc on the undo history (Unselect all items + Select items under edit cursor in the undo history for each defer call). Also it doesn't seem to be possible to select items currently being recorded unless the track is set to one of the MIDI overdub/replace modes.

What I had wanted to do was to mimic Logic's behavior where recording MIDI items were red and active in the MIDI editor. That behavior isn't looking overly achievable in Reaper so far.

Thanks for the ideas anyway, mespotine!
tack is online now   Reply With Quote
Old 11-16-2019, 08:16 AM   #538
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Location: Croatia
Posts: 2,229
Default

Is there an easy way to import KeyMaps from ReaScript? I can't seem to find any API relevant for Lua scripts.

I would like to automatically update reaper-kb.ini and I would like to chose to only import actions/macros or only shortcuts from ReaperKeyMap files.

Bonus question: would it be possible to do the same for menus?
Breeder is offline   Reply With Quote
Old 11-17-2019, 09:48 AM   #539
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

Short answer, no.
Long answer, I'm working on that for Ultraschall - Api.

Do you mean import at runtime or is importing with restart ok too?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-19-2019, 04:03 AM   #540
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Location: Croatia
Posts: 2,229
Default

Quote:
Originally Posted by mespotine View Post
Short answer, no.
Long answer, I'm working on that for Ultraschall - Api.

Do you mean import at runtime or is importing with restart ok too?
Awesome. Runtime is always the best, but in my case, I can just ask the user to restart.
Maybe it would be possible through an extenstion to get it at runtime?
Breeder is offline   Reply With Quote
Old 11-19-2019, 09:02 AM   #541
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

Yes, for more information on that, just head over to this thread:
https://forum.cockos.com/showthread.php?t=226007

Edit: Menus wouldn't be possible that way, but I don't know much about the C++-only-Reaper-functions, who allow accessing the menu. Maybe it's possible that way...
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-27-2019, 02:51 PM   #542
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 68
Default

How to call custom action from a script? I am trying to call a custom action through a lua script like: reaper.Main_OnCommand(reaper.NamedCommandLookup( "_749daf2e6c9d244d99884fae060ecce6"), 0, 0)

But the action is not triggering for some reason, is there anything that i am missing?
BirdBird is online now   Reply With Quote
Old 11-27-2019, 05:02 PM   #543
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

In which section is the action? Main?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 11-27-2019, 05:08 PM   #544
BirdBird
Human being with feelings
 
BirdBird's Avatar
 
Join Date: Mar 2019
Posts: 68
Default

The command is on the MIDI Editor, is there a different call in the API for that?

Edit: Thanks, there is, i just saw it
BirdBird is online now   Reply With Quote
Old 11-28-2019, 09:26 AM   #545
mespotine
Human being with feelings
 
mespotine's Avatar
 
Join Date: May 2017
Location: Leipzig, Germany
Posts: 1,690
Default

Can we access gmem-states from the C++-extension-API somehow?
__________________
Ultraschall-API - a Lua-functions-library4Reaper: https://forum.cockos.com/showthread....98#post2067798
Reaper Internals - Developerdocs4Reaper: https://forum.cockos.com/showthread.php?t=207635
mespotine is offline   Reply With Quote
Old 12-05-2019, 11:17 AM   #546
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 14
Default

Hi,
Ive developed an EQ plugin with JUCE and would love to add its GUI to the REAPER 6 MCP, with the new "embedded FX GUI" feature.
Would anyone have any starters on how this could be acheived? Ive been looking around but couldnt find anything...
Gertius is offline   Reply With Quote
Old 12-05-2019, 12:09 PM   #547
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,936
Default

Quote:
Originally Posted by Gertius View Post
Hi,
Ive developed an EQ plugin with JUCE and would love to add its GUI to the REAPER 6 MCP, with the new "embedded FX GUI" feature.
Would anyone have any starters on how this could be acheived? Ive been looking around but couldnt find anything...
Oh, this new feature sounds great, exactly what I was looking for, e.g. for embedding permanent VU meter for master. And now we have this feature already?
TonE is online now   Reply With Quote
Old 12-05-2019, 12:41 PM   #548
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,936
Default

Quote:
Originally Posted by pianogineer View Post
I'm trying to use Reaper for live, mainly for backing tracks, but also potentially some keyboard patches. I'm using 1 project per song/set of patches.
Backing tracks sounds like spleeter.
TonE is online now   Reply With Quote
Old 12-05-2019, 01:23 PM   #549
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 14
Default

Quote:
Originally Posted by TonE View Post
Oh, this new feature sounds great, exactly what I was looking for, e.g. for embedding permanent VU meter for master. And now we have this feature already?
Yes! The feature is now implemented. You can already have a permanent VU Meter in Master with "JS VU Meter". You have to right-click the plugin on the track and then select "Show embedded UI in MCP".

Now I would like to know if I can use the feature for my own developments with Juce. If anybody had a hint, Id be grateful!
Gertius is offline   Reply With Quote
Old 12-05-2019, 06:47 PM   #550
nofish
Human being with feelings
 
nofish's Avatar
 
Join Date: Oct 2007
Location: home is where the heart is
Posts: 9,197
Default

Quote:
Originally Posted by Gertius View Post
Now I would like to know if I can use the feature for my own developments with Juce. If anybody had a hint, Id be grateful!
Justin said they'll expose the API but afaik it has not happened yet.
https://forum.cockos.com/showthread....60#post2047760
nofish is online now   Reply With Quote
Old 12-06-2019, 08:34 AM   #551
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 14
Default

Quote:
Originally Posted by nofish View Post
Justin said they'll expose the API but afaik it has not happened yet.
https://forum.cockos.com/showthread....60#post2047760
Awesome, thanks for the info! I will monitor the forum I guess. Do you know where things like that will be announced?
Gertius is offline   Reply With Quote
Old 12-06-2019, 10:25 AM   #552
Breeder
Human being with feelings
 
Breeder's Avatar
 
Join Date: Nov 2010
Location: Croatia
Posts: 2,229
Default

Quote:
Originally Posted by mespotine View Post
Yes, for more information on that, just head over to this thread:
https://forum.cockos.com/showthread.php?t=226007

Edit: Menus wouldn't be possible that way, but I don't know much about the C++-only-Reaper-functions, who allow accessing the menu. Maybe it's possible that way...
If I remember correctly, in C++ you can load stuff in the menus, but you can't edit the menu itself permanently - it gets populated at runtime and that's it. I am just searching for a way to quickly update REAPER ReWorked so I don't have to make the user load menus and keymaps by hand. Messing with .ini files here isn't what I would personally like to do - I would rather do it via API so I'm 100% sure these things won't ever break in case of some change.

P.S.
Sorry for the late response!
Breeder is offline   Reply With Quote
Old 12-06-2019, 01:55 PM   #553
TonE
Human being with feelings
 
Join Date: Feb 2009
Location: Reaper HAS send control via midi !!!
Posts: 1,936
Default

Quote:
Originally Posted by Gertius View Post
Yes! The feature is now implemented. You can already have a permanent VU Meter in Master with "JS VU Meter". You have to right-click the plugin on the track and then select "Show embedded UI in MCP".

Now I would like to know if I can use the feature for my own developments with Juce. If anybody had a hint, Id be grateful!
But only for jsfx for now I read in an article, so not any vst? That would be cool. Just the vst gui opened inside the mixer or tcp. Because there are also other nice tools, like spectrogram, but the problem is probably what to do if those are not stretchable by themselves? I guess the solution to that is just using multiple screens. But my laptop has only one screen. Reaper could be optimized for laptop scenarios. How to do it? Check Ableton Live's window concepts. Reaper has already docking but docking should be possible into the tcp or mcp, in any position, e.g. to the side of the master track, at least.
TonE is online now   Reply With Quote
Old 12-09-2019, 04:01 AM   #554
Xenakios
Human being with feelings
 
Xenakios's Avatar
 
Join Date: Feb 2007
Location: Oulu, Finland
Posts: 8,001
Default

Quote:
Originally Posted by Gertius View Post

Now I would like to know if I can use the feature for my own developments with Juce. If anybody had a hint, Id be grateful!
The information how to do it for VST2 plugins is now available in :

https://landoleet.org/dev/reaper_plugin.h (look for parts with "fx-embed".)

I would estimate using that is going to be quite challenging from Juce-based plugins. Reaper expects the embedded plugin GUIs to use Lice for the graphics etc. You need to be able to handle vendor specific VST2 canDos and opcodes, and Juce may not currently have the needed support for those, so you may need to alter the Juce source code itself.
__________________
For info on SWS Reaper extension plugin (including Xenakios' previous extension/actions) :
http://www.sws-extension.org/
https://github.com/Jeff0S/sws
--
Xenakios blog (about HourGlass, Paul(X)Stretch and λ) :
http://xenakios.wordpress.com/
Xenakios is offline   Reply With Quote
Old 12-10-2019, 12:28 AM   #555
Gertius
Human being with feelings
 
Join Date: Nov 2012
Posts: 14
Default

Quote:
Originally Posted by Xenakios View Post
The information how to do it for VST2 plugins is now available in :

https://landoleet.org/dev/reaper_plugin.h (look for parts with "fx-embed".)

I would estimate using that is going to be quite challenging from Juce-based plugins. Reaper expects the embedded plugin GUIs to use Lice for the graphics etc. You need to be able to handle vendor specific VST2 canDos and opcodes, and Juce may not currently have the needed support for those, so you may need to alter the Juce source code itself.
Thanks! Ill look into it.
Gertius is offline   Reply With Quote
Old 12-11-2019, 07:43 PM   #556
LarrySeyer
Human being with feelings
 
LarrySeyer's Avatar
 
Join Date: Sep 2006
Location: Austin, Tx
Posts: 39
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.

Does that feature exist in Reaper?
LarrySeyer 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:20 PM.


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