|
|
|
01-15-2015, 08:31 AM
|
#681
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
Edufighter, maybe "Xenakios/SWS: reposition selected items" does what you want.
edit-
gwok, not sure if this is the best way...
SWS is needed.
Code:
//select all sub-parents_global
Main_OnCommand(40296, 0);//select all tracks
Main_OnCommand(NamedCommandLookup("_SWS_SELCHILDREN"), 0);
x = CountSelectedTracks(0);
while(x > 0)(
trk = GetSelectedTrack(0, x - 1);
GetMediaTrackInfo_Value(trk, "I_FOLDERDEPTH") != 1 ? (
SetTrackSelected(trk, 0);
);
x -= 1;
);
Undo_OnStateChange("select all sub-parents_global");
You can run the following on more than one parent-
Code:
//select all sub-parents
Main_OnCommand(NamedCommandLookup("_SWS_SELCHILDREN"), 0);
x = CountSelectedTracks(0);
while(x > 0)(
trk = GetSelectedTrack(0, x - 1);
GetMediaTrackInfo_Value(trk, "I_FOLDERDEPTH") != 1 ? (
SetTrackSelected(trk, 0);
);
x -= 1;
);
Undo_OnStateChange("select all sub-parents");
Last edited by FnA; 01-15-2015 at 11:00 AM.
|
|
|
01-15-2015, 11:01 AM
|
#682
|
Human being with feelings
Join Date: Feb 2012
Location: Canada
Posts: 35
|
FnA You got it!! Thanks!
I had the feeling somebody thought about this everyday problem of sfx editor already.
It works exactly as I wanted. prompt for the time between items and nicely space them in the timeline.
Problem solved. thanks to the forum for being always so helpful.
|
|
|
01-15-2015, 11:18 AM
|
#683
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
No prob.
Someone else will have to do vanhazes. IDK.
and JoPos etc.
Last edited by FnA; 01-15-2015 at 12:04 PM.
|
|
|
01-15-2015, 12:24 PM
|
#684
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
Thanks a lot FnA.
Unfortunately I'm getting errors from them both. I seem to often have trouble running scripts people have made for me, and I havent really found out why. For a while I thought it was because Reaper is calling up the wrong version of python (im on osx which has python natively on the os, though I have the newest one on my system too), though I never resolved it with that line of investigation
So it is likly your script is fine, I don' now why my system likes to do this sometimes......
Quote:
Script execution error
Traceback (most recent call last):
File "Select Sub-Parents_Global.py", line 1
//select all sub-parents_global
^
SyntaxError: invalid syntax
|
|
|
|
01-15-2015, 12:33 PM
|
#685
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
It's an eel script, not python.
|
|
|
01-15-2015, 12:40 PM
|
#686
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
DOh!!
working great, thanks man!!!
Quote:
Originally Posted by FnA
It's an eel script, not python.
|
|
|
|
01-15-2015, 03:03 PM
|
#687
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
That's cool. I can do a little more with python, but that's not saying a whole lot. Sometimes they won't work for someone else.
|
|
|
01-23-2015, 11:54 AM
|
#688
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
Hi guys,
Is this possible with an eel script?
Create time selection from the first marker to the last marker in a project?
Thanks in advance,
Wyatt
|
|
|
01-23-2015, 12:56 PM
|
#689
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by WyattRice
Hi guys,
Is this possible with an eel script?
Create time selection from the first marker to the last marker in a project?
Thanks in advance,
Wyatt
|
Here's a simple script for that:
Code:
CountProjectMarkers(0, num_markers, 0);
num_markers > 1 ? (
Undo_BeginBlock();
c_pos = GetCursorPosition();
PreventUIRefresh(1);
GoToMarker(0, 1, 1);
start = GetCursorPosition();
GoToMarker(0, num_markers, 1);
end = GetCursorPosition();
GetSet_LoopTimeRange(1, 0, start, end, 0);
SetEditCurPos(c_pos, 0, 0);
PreventUIRefresh(-1);
Undo_EndBlock("Create time selection",-1);
);
Edit: Undo_OnStateChange didn't work - added Undo_Begin/EndBlock
|
|
|
01-23-2015, 01:35 PM
|
#690
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
Quote:
Originally Posted by spk77
Here's a simple script for that:
|
Wonderful!
Many Thanks,
Wyatt
|
|
|
01-28-2015, 10:31 AM
|
#691
|
Human being with feelings
Join Date: Feb 2012
Location: Canada
Posts: 35
|
Extend all region's length
Hi,
I would need to extend all regions in a project by X amount of seconds.
Let's say all my regions are 2 seconds long and through an .eel script I turn them in a 3 seconds long by extending the right boundary of the region while preserving the region start time.
If this script has a way to input the amount of seconds to extend the region would be perfect.
If any of you coders-magician can help me with this, it might be awesome.
Many thanks in advance.
|
|
|
01-28-2015, 11:19 AM
|
#692
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Edufighter
Hi,
I would need to extend all regions in a project by X amount of seconds.
Let's say all my regions are 2 seconds long and through an .eel script I turn them in a 3 seconds long by extending the right boundary of the region while preserving the region start time.
If this script has a way to input the amount of seconds to extend the region would be perfect.
If any of you coders-magician can help me with this, it might be awesome.
Many thanks in advance.
|
Here's Extend all region ends by X seconds:
(note: negative values works too)
Code:
// Extend all region ends by X seconds
// EEL script by SPK77 28.1.2015
function move_region_end_to_cursor(new_rgn_end)
(
i = 0;
while(EnumProjectMarkers(i, is_region, pos, rgn_end, #name, markrgn_index_number) > 0) (
is_region ? (
SetProjectMarker(markrgn_index_number, 1, pos, max(rgn_end+new_rgn_end,pos), #name);
);
i += 1;
);
);
ok = GetUserInputs("Extend all region ends by X seconds", 1, "Extend all region ends by...", #retvals);
ok && match("%f", #retvals, new_rgn_end) ? move_region_end_to_cursor(new_rgn_end);
Undo_OnStateChangeEx("Extend region ends",-1,-1);
Edit: added a limit (0s) for region length
Last edited by spk77; 01-28-2015 at 11:42 AM.
|
|
|
01-28-2015, 11:25 AM
|
#693
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
hey guys,
do any of you have some suggestions on how to learn to make my own scripts? I have a bit of experience with rudimentary coding, mostly on the lemur. I know a bit about storing variables, making arrays, if statements etc. Haven't dealt with loops too much.
I feel I could probably pick it up quite quick, but it would be nice to just get a clear idea on the basics from the get go. I've never done anything with any api's, so the syntax and formatting of scripts I'm not so clear on. I realize there is documentation for all the functions, but I am not so clear really just how to get started.
Any suggestions would be greatly appreciated!
thx
|
|
|
01-28-2015, 12:43 PM
|
#694
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
script request: actions for alternate grid settings
1/5
1/7
1/9
1/11
1/13
this way one can set alternate grid settings with relative ease. I believe further subdivisions of those should be possible with the actions to double or half the grid settings so theres no need for 2/5 etc
thanks!
|
|
|
01-28-2015, 12:45 PM
|
#695
|
Human being with feelings
Join Date: Feb 2012
Location: Canada
Posts: 35
|
Extend all region's length
Thank you very much spk77 worked like a charm!!
You're a code wizard indeed
Cheers,
Ed
|
|
|
01-28-2015, 03:07 PM
|
#696
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by gwok
hey guys,
do any of you have some suggestions on how to learn to make my own scripts? I have a bit of experience with rudimentary coding, mostly on the lemur. I know a bit about storing variables, making arrays, if statements etc. Haven't dealt with loops too much.
I feel I could probably pick it up quite quick, but it would be nice to just get a clear idea on the basics from the get go. I've never done anything with any api's, so the syntax and formatting of scripts I'm not so clear on. I realize there is documentation for all the functions, but I am not so clear really just how to get started.
Any suggestions would be greatly appreciated!
thx
|
I learned from other people's scripts .
3 important functions: - CountSelectedMediaItems
- GetSelectedMediaItem
- ShowConsoleMsg (useful for debugging)
This EEL script prints selected item's starting positions:
PHP Code:
// EEL: int CountSelectedMediaItems(ReaProject* proj)
// count the number of selected items in the project (proj=0 for active project)
num_sel_items = CountSelectedMediaItems(0); // store number of selected items to variable "num_sel_items"
i = 0;
// run loop "num_sel_items" times
loop(num_sel_items,
// EEL: MediaItem* GetSelectedMediaItem(ReaProject* proj, int selitem)
// get a selected item by selected item count (zero-based) (proj=0 for active project)
item_pointer = GetSelectedMediaItem(0, i); // store item pointer (MediaItem*) to "item_pointer" variable
// EEL: double GetMediaItemInfo_Value(MediaItem* item, "parmname")
item_position = GetMediaItemInfo_Value(item_pointer, "D_POSITION"); // returns item start position (the position is stored to "item_position" variable
ShowConsoleMsg(sprintf(#, "%f", item_position)); // convert "item_position" to string and show the value in "ReaScript Console"
ShowConsoleMsg("\n"); // print "newline"
i += 1; // add "1" to i
);
Quote:
Originally Posted by gwok
script request: actions for alternate grid settings
1/5
1/7
1/9
1/11
1/13
this way one can set alternate grid settings with relative ease. I believe further subdivisions of those should be possible with the actions to double or half the grid settings so theres no need for 2/5 etc
thanks!
|
This is not very easy at the moment. The grid settings are stored in project files - it's hard to modify them (with EEL).
Quote:
Originally Posted by Edufighter
Thank you very much spk77 worked like a charm!!
You're a code wizard indeed
Cheers,
Ed
|
Thanks! Glad it worked
|
|
|
01-28-2015, 06:52 PM
|
#698
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
Quote:
Originally Posted by X-Raym
|
Holy shitballs! That's perfect thanks!
That site should be a sticky at the top of this forum or something
thanks X-Raym, and spk77
|
|
|
01-29-2015, 12:54 AM
|
#699
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,874
|
@gwok
haha thank you !
Because you liked it so much, I just update it with a new chapter dedicated to ReaScript code sharing ! Code conventions, platforms, naming etc...
Don't miss that part, it is mire important than a lot of people know
Good coding !
|
|
|
01-29-2015, 05:39 PM
|
#700
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
Needs SWS python, so yeah, python only.
Code:
### sixteenth note quintuplets
from reaper_python import *
from sws_python import *
SNM_SetDoubleConfigVar("projgriddiv", 1/5)
RPR_UpdateTimeline()
Just change 5 to 7, 11, etc. And the comment at top, if you like.
|
|
|
01-29-2015, 08:29 PM
|
#701
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
Quote:
Originally Posted by FnA
Needs SWS python, so yeah, python only.
Code:
### sixteenth note quintuplets
from reaper_python import *
from sws_python import *
SNM_SetDoubleConfigVar("projgriddiv", 1/5)
RPR_UpdateTimeline()
Just change 5 to 7, 11, etc. And the comment at top, if you like.
|
works great! thanks!
|
|
|
02-04-2015, 10:11 AM
|
#702
|
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
|
Does anyone here know if it's possible to create a script that allows you to "slip" the contents of a piece of audio whilst also moving the right edge of the item too?
So the "contents" of the audio item say slip leftwards with the "left edge" staying still but the "right edge" of that item shrinks by the same amount that you have slipped the item's contents by.
This should also be possible the other way too. If you make the item's "contents" slip rightwards the "left edge" of the item stays still but the "right edge" expands rightwards.
This would be so useful for sound design as I often want to slip a sound earlier or later but also increase or decrease the right edge to keep the exact same end time.
Hope that makes sense?
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
|
|
|
02-04-2015, 02:33 PM
|
#703
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by musicbynumbers
Does anyone here know if it's possible to create a script that allows you to "slip" the contents of a piece of audio whilst also moving the right edge of the item too?
So the "contents" of the audio item say slip leftwards with the "left edge" staying still but the "right edge" of that item shrinks by the same amount that you have slipped the item's contents by.
This should also be possible the other way too. If you make the item's "contents" slip rightwards the "left edge" of the item stays still but the "right edge" expands rightwards.
This would be so useful for sound design as I often want to slip a sound earlier or later but also increase or decrease the right edge to keep the exact same end time.
Hope that makes sense?
|
This is possible, but I don't know exactly how it should work
I quickly modified the quantize tool to test if it is possible (movement range = +-1 second):
Would this work for you?
EDIT: Saw your request in "v5.0pre - New ReaScript functions/IDE testing"
I think, this isn't possible with BR_functions (there has to be a GUI to get the "mouse click"/"mouse delta x" positions etc. afaik).
Last edited by spk77; 02-04-2015 at 03:00 PM.
|
|
|
02-05-2015, 03:11 AM
|
#704
|
Human being with feelings
Join Date: Jun 2009
Location: South, UK
Posts: 14,214
|
That's pretty cool!
If it was accessible as a quick modifier it would be perfect. I think I would need to ask the devs for it
I'll ask them and if it's cool with you, use your video as an example?
EDIT:I've posted it up but let me know if you want me to not use it.
Thanks for doing that though! love what you've been doing so far too!
Quote:
Originally Posted by spk77
This is possible, but I don't know exactly how it should work
I quickly modified the quantize tool to test if it is possible (movement range = +-1 second):
Would this work for you?
EDIT: Saw your request in "v5.0pre - New ReaScript functions/IDE testing"
I think, this isn't possible with BR_functions (there has to be a GUI to get the "mouse click"/"mouse delta x" positions etc. afaik).
|
__________________
subproject FRs click here
note: don't search for my pseudonym on the web. The "musicbynumbers" you find is not me or the name I use for my own music.
Last edited by musicbynumbers; 02-05-2015 at 03:37 AM.
|
|
|
02-05-2015, 04:04 AM
|
#705
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Quote:
Originally Posted by FnA
Needs SWS python, so yeah, python only.
Code:
### sixteenth note quintuplets
from reaper_python import *
from sws_python import *
SNM_SetDoubleConfigVar("projgriddiv", 1/5)
RPR_UpdateTimeline()
Just change 5 to 7, 11, etc. And the comment at top, if you like.
|
Could this be modified so that the script asks user's input for the denominator?
|
|
|
02-05-2015, 05:35 PM
|
#706
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
Quote:
Originally Posted by amagalma
Could this be modified so that the script asks user's input for the denominator?
|
Neat idea.
Code:
### Grid: divide quarter note by input
from reaper_python import *
from sws_python import *
def dialog():
defvalues = ","
maxreturnlen = 20 # one more than what you expect to get back
nitems = 1 # number of input boxes
Query = RPR_GetUserInputs("Divide quarter note grid by",nitems,"enter value",defvalues,maxreturnlen)
if Query[0] == 1: # user clicked OK
UserValues = Query[4].split(',')
if UserValues[0] != []:
PF = str(UserValues[0])
PFL.append(PF)
PFL = []
dialog()
input = 0
if PFL == []:
pass
else:
input = float(PFL[0])
SNM_SetDoubleConfigVar("projgriddiv", 1/input)
RPR_UpdateTimeline()
RPR_Undo_OnStateChange("divide quarter note grid")
|
|
|
02-05-2015, 05:54 PM
|
#707
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thank you very much!
It works nice but it doesn't create an undo point. To undo it, I changed your first script:
Code:
### Undo tuplet grid division
from reaper_python import *
from sws_python import *
SNM_SetDoubleConfigVar("projgriddiv", 1/1)
RPR_UpdateTimeline()
Now, it would be nice if the "tuplet" script could save the grid setting before it is applied, and the "undo" script to recall the grid setting before the tuplet! Is this possible?
|
|
|
02-05-2015, 06:49 PM
|
#708
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
I think it might be with ExtState, but I've never used that before. If that don't work I think a txt file somewhere could be used to store it.
|
|
|
02-11-2015, 02:24 PM
|
#709
|
Human being with feelings
Join Date: Jun 2012
Posts: 2,173
|
Well, like I said, I don't have any experience with this one. Might blow up the pooter.
Code:
### save grid 1
from reaper_python import *
from sws_python import *
grid1_save = SNM_GetDoubleConfigVar("projgriddiv", 1)
RPR_SetExtState("grid", "one", grid1_save, 0)#section,key,value,persist
RPR_Undo_OnStateChange("save grid 1")
Code:
### restore grid 1
from reaper_python import *
from sws_python import *
ES = RPR_GetExtState("grid", "one")
if ES:
gr = float(ES)
SNM_SetDoubleConfigVar("projgriddiv", gr)
RPR_UpdateTimeline()
RPR_Undo_OnStateChange("restore grid 1")
Section and key looks like a matrix to refer to. Persist means until next time you open Reaper apparently. 0 for no, 1 for yes.
|
|
|
02-12-2015, 05:20 AM
|
#710
|
Human being with feelings
Join Date: Apr 2011
Posts: 3,451
|
Thank you!!!
Works great!
|
|
|
02-13-2015, 04:17 PM
|
#711
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Zoom out to exact project length
I've got a really simple request this time.
Reapers "Zoom out project" action leaves a fairly large space at the end of the project
Is it possible to make a script that measures the length of the used space in the arrangement and zooms horizontally exactly to that..
I know it's nit pick but.......
|
|
|
02-13-2015, 05:42 PM
|
#712
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,874
|
@Triode
I don't have any problem with the Zoom Out Project action, it adjsut pretty well, no matter what is my project duration, without any unbalanced empty space.
Are you sure you don't have any small lost item at the end of the project ? It can happend, sometimes !
|
|
|
02-13-2015, 05:48 PM
|
#713
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Don't you see empty space after the last item once you use that action? I'd like no empty space at all horizontally..
|
|
|
02-13-2015, 07:49 PM
|
#714
|
Human being with feelings
Join Date: Apr 2013
Location: France
Posts: 9,874
|
@Triode
Really just a bit, but nothing shocking or disturbing.
But if for some reason you don't want it at all, I cannnot help you on that. I never worked with zoom in Scripts !
|
|
|
02-14-2015, 07:30 AM
|
#715
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Yeah not shocking or disturbing. Just slightly irking
|
|
|
02-19-2015, 05:00 PM
|
#716
|
Human being with feelings
Join Date: May 2014
Location: Brooklyn
Posts: 52
|
Request: Playback Seek
Sometimes I have a long file and, if the track is playing, I just want playback to continue from where I throw down the cursor, marking potential edit points. I don't like using the Ruler for this because although it seeks playback the edit cursor is elsewhere.
The closest I've come using stock commands is
Media Left Click= View: move edit cursor to mouse cursor ignoring snapping
and
Media Left Alt+Click = View: move edit cursor to mouse cursor ignoring snapping & Transport Play
So, there is a "move edit cursor to play cursor"
But no "move play cursor to mouse/edit cursor"
and no "if"s in the action list.
I'm not a programmer but I think the next step would be Rea Script/ Python.
Something like:
# If track is playing, move edit cursor to mouse cursor (taking toggle state of Snap/Grid into account)
# and seek playback from there. So:
if (current play state = false);
RPR_Main_OnCommand(actionnumber, 39614);
#move edit cursor to mouse cursor
if (current play state = true);
PR_Main_OnCommand(actionnumber, 39614);
RPR_OnPlayButton()
#move edit cursor to mouse cursor and continue playing from there
Something like this would go a long way towards me actually working with Reaper instead of just goofing around with it.
I appreciate any replies, including non-script ideas. Working towards a one-click world!
Cheers,
Brookwood
|
|
|
02-19-2015, 05:09 PM
|
#717
|
Human being with feelings
Join Date: Jun 2012
Location: Spain
Posts: 7,238
|
Quote:
Originally Posted by Brookwood
Sometimes I have a long file and, if the track is playing, I just want playback to continue from where I throw down the cursor, marking potential edit points.
|
you may love the SWS Breeder actions. Like this one:
SWS/BR: Toggle preview media item under mouse and pause during preview (start from mouse cursor position)
|
|
|
02-19-2015, 09:09 PM
|
#718
|
Human being with feelings
Join Date: May 2014
Location: Brooklyn
Posts: 52
|
Hmmm
Looks promising...
|
|
|
02-19-2015, 11:47 PM
|
#719
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
There are also SWS/BR actions to play/play or pause/ play or stop from mouse cursor position.
Just search the action list for "sws br play OR sws br preview" to find all the preview and play actions
I'm also working on "perform until shortcut release" versions of these (both for arrange and midi editor) and with some new versions (solo track under mouse cursor while the playback is running etc...)
It will probably appear in the next SWS pre if I make it (the hardest part is to rewrite part of the code that makes "perform until shorcut release" possible so it works with MIDI editor)
Last edited by Breeder; 02-19-2015 at 11:53 PM.
|
|
|
02-21-2015, 12:21 PM
|
#720
|
Human being with feelings
Join Date: May 2014
Location: Brooklyn
Posts: 52
|
Great!
So, what I set up in MouseMods is:
MediaItem:
Left Click:
Default Action:
Select Item and move edit cursor
and
MediaItem:
Alt+Left Click:
SWS/BR Play from mouse cursor position
This might even be better than the script idea I had because, for the price of pressing one alt key I can either couple or decouple the mouse cursor from playback which has more flexibility.
I also set up my up and down arrows to set loop points on the fly which helps my workflow a lot in certain situations.
Finally starting to tame this bronco thanks to such generous posters and contributors.
Thanks!
|
|
|
Thread Tools |
|
Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
All times are GMT -7. The time now is 01:25 AM.
|