Old 10-15-2009, 05:56 AM   #1
Anton9
Human being with feelings
 
Anton9's Avatar
 
Join Date: Jun 2009
Location: Earth
Posts: 1,335
Default ReaScript (Python) Questions

Hello,

Could someone help get me started with ReaScript(Python) ? I've tried dub3000's toggleMute script and it works fine. So I thought if I wanted to toggle bypass FX I should just be able to change all the "B_MUTE" in his script to "I_FXEN" but nothing happens. Maybe someone could post an example of doing this for a specific track.., let's say track 3.

I also noticed in dub3000's script that in order to operate on multiple tracks he uses trackIdx.., so my next question is can media items also be indexed and manipulated in a similar way ? Please provide examp. of muting multiple items.

Is it possible to open the FX window of a track using ReaScript ?

Two more questions Lets say I have 50 tracks and I want to mute every n'th one in the range of track 10-20, how might this be accomplished ?

Last question.., it's a bit of an advanced one so I hope it's possible and someone can provide an example... Let's say I have 10 tracks, each with ReaPitch and I wanted to interpolate the Shift(semitones) param. from -12 to 12 across these 10 tracks.., please tell me this is possible ?

Thank You...,
Anton
Anton9 is offline   Reply With Quote
Old 10-15-2009, 06:28 AM   #2
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,461
Default

Quote:
Originally Posted by Anton9 View Post
Hello,

Could someone help get me started with ReaScript(Python) ? I've tried dub3000's toggleMute script and it works fine. So I thought if I wanted to toggle bypass FX I should just be able to change all the "B_MUTE" in his script to "I_FXEN" but nothing happens. Maybe someone could post an example of doing this for a specific track.., let's say track 3.
I havent seen dub3000's script, but I_FXEN is using integers as a return value type instead of Boolean, that might be where the problem lies.

From the SDK: "I_FXEN" : int * : 0=fx bypassed, nonzero = fx active". So dont check for true or false but check for equal or not equal to zero

Quote:
Originally Posted by Anton9 View Post
I also noticed in dub3000's script that in order to operate on multiple tracks he uses trackIdx.., so my next question is can media items also be indexed and manipulated in a similar way ? Please provide examp. of muting multiple items.
This might be a little more hard to do. There are functions to get the number of mediaitems of a media track, and there are functions to get/set parameters like mute on the specific mediaitem of the track, check out the reascript help file in the actions menu.

e.g. there is "MediaItem* GetTrackMediaItem(MediaTrack* tr, int itemidx)" which hands you back the media-item of a specific track. Then you can use Get/SetMediaItemInfo_Value to get/set the mediaitem parameters.


Quote:
Originally Posted by Anton9 View Post
Is it possible to open the FX window of a track using ReaScript ?
Use the Main_OnCommand call. Go to the actions menu and look up the number of the action that handles this (look at the far right). then execute Main_OnCommand with this command number.


Quote:
Originally Posted by Anton9 View Post
Two more questions Lets say I have 50 tracks and I want to mute every n'th one in the range of track 10-20, how might this be accomplished ?

Last question.., it's a bit of an advanced one so I hope it's possible and someone can provide an example... Let's say I have 10 tracks, each with ReaPitch and I wanted to interpolate the Shift(semitones) param. from -12 to 12 across these 10 tracks.., please tell me this is possible ?

Thank You...,
Anton
Yves
yhertogh is offline   Reply With Quote
Old 10-15-2009, 06:10 PM   #3
Anton9
Human being with feelings
 
Anton9's Avatar
 
Join Date: Jun 2009
Location: Earth
Posts: 1,335
Default

Yves,

Thanks for your input.., still stuck. Here is dub3000's script.
---------------------------------------------------------------------
# This Reaper script toggles Mute for all tracks
RPR_ShowConsoleMsg("Starting script...\n")

# count # tracks
numTracks = RPR_CountTracks(0)
RPR_ShowConsoleMsg("Main project has " + str(numTracks) + " tracks.\n")

# iterate through all tracks
for trackIdx in range(0,numTracks):
# get the track object for this track number
track = RPR_GetTrack(0, trackIdx)
isMuted = RPR_GetMediaTrackInfo_Value(track, "B_MUTE")
if isMuted==0:
# track IS NOT muted: mute track
RPR_SetMediaTrackInfo_Value(track, "B_MUTE", 1.0)
else:
# track IS muted, unmute track
RPR_SetMediaTrackInfo_Value(track, "B_MUTE", 0.0)

RPR_ShowConsoleMsg("Toggled mute for all tracks\n");
--------------------------------------------------------------------
So what I did was replace all the "B_MUTE" with "I_FXEN" It seems like that should work but it does'nt. I have been reading the ReaScript documentation, but I'm having problems with formulating the correct syntax because there is no examples to go by.

Can somebody out there please tackle my last two questions in the original post and provide code. This would open up a whole new avenue of interaction with Reaper for me.

Maybe Justin or Schwa if you read this and don't have time to post code please let me know if those two things are at all possible.

Thank You..,
Anton
Anton9 is offline   Reply With Quote
Old 10-15-2009, 07:00 PM   #4
schwa
Administrator
 
schwa's Avatar
 
Join Date: Mar 2007
Location: NY
Posts: 10,386
Default

Ah, that's a bug in ReaScript, none of the "I" params will respond to being set. Fixing.
schwa is offline   Reply With Quote
Old 10-16-2009, 02:50 AM   #5
Anton9
Human being with feelings
 
Anton9's Avatar
 
Join Date: Jun 2009
Location: Earth
Posts: 1,335
Default

Thank you Schwa
Anton9 is offline   Reply With Quote
Old 10-16-2009, 06:10 AM   #6
yhertogh
Human being with feelings
 
yhertogh's Avatar
 
Join Date: Nov 2006
Location: Belgium
Posts: 1,461
Default

Quote:
Originally Posted by Anton9 View Post
Thank you Schwa
amazing :-)
yhertogh 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 02:06 AM.


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