|
|
|
09-03-2012, 09:10 AM
|
#1
|
Human being with feelings
Join Date: Mar 2007
Posts: 21,551
|
Script Request Sticky?
Is it possible to make a "sticky thread" to make scripting requests from the scripting guys like Viente and Tim?
I see them doing a lot of that, quickly making new scripts to solve various issues, but all that stuff is kinda scattered all over the forum. It might be nice to go to one place and say...
"Hey! Can anyone create a quick script to _________?"
And have the scripts attached and listed there in one thread along with discussions about how they work.
I for one haven't devled into ReaScript much. The language doesn't look all that difficult for me having done Javascript and similar, but I assume to some others with no coding background at all it kinda looks like Greek.
Thanks.
|
|
|
09-03-2012, 09:16 AM
|
#2
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
I would like to share. Though i'm a complete noob in ReaScript i have a bunch of usefull scripts people may like (Thanks to Tim, gofer and IXix)
|
|
|
09-14-2012, 12:47 PM
|
#3
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
quantisation of parameter automation values
Hey! Can anyone create a quick script to quantise parameter automation values?
I'm interested in both quantisation on the time scale (e.g. values should be shifted towards the nearest 16th note grid line, while preventing multiple values on the same position on the timeline) and/or on the value range (e.g. for a parameter that affects tuning with a range of -12 to 12 semi-tones, it should be able to divide the 0.0-1.0 range in 25 steps, i.e. 0.00, 0.04, 0.08, 0.12, ... 0.96, 1.00).
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
09-24-2012, 12:44 PM
|
#5
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
I see there is GetCursorContext command.
Can anyone make a script that opens toolbar at each condition?
|
|
|
09-24-2012, 12:58 PM
|
#6
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
I could really use "set selected items to one random custom color per track"
|
|
|
09-24-2012, 01:22 PM
|
#8
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
thanks man - though I'm getting this -
"Script execution error
Traceback (most recent call last):
File "Auto color all items.py", line 1
SAVESEL = RPR_NamedCommandLookup('_SWS_SAVESEL')
^
SyntaxError: invalid syntax
"
just update python to 3.23, same result though (osx 10.6.8)
|
|
|
09-24-2012, 01:24 PM
|
#9
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Hmm...working here.
Do you have SWS Extension?
|
|
|
09-24-2012, 01:25 PM
|
#10
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
yep, how would that have an effect?
I'll update sws now....
edit: updated SWS same result
|
|
|
09-24-2012, 02:22 PM
|
#11
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Maybe something with text encoding...i dont know really
It works on Windows 7
|
|
|
09-24-2012, 02:30 PM
|
#12
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
Viente is that possible what I've posted above?
|
|
|
09-24-2012, 02:33 PM
|
#13
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Could you please explain a little bit more what you want?
|
|
|
09-24-2012, 02:39 PM
|
#14
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
int GetCursorContext()
0 if track panels, 1 if items, 2 if envelopes, otherwise unknown
can it be made so when state is 0 trigger action X,1 trigger action Y,2 trigger action Z ?
|
|
|
09-24-2012, 02:40 PM
|
#15
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
I'll take a look now
|
|
|
09-24-2012, 02:41 PM
|
#16
|
Human being with feelings
Join Date: Jun 2009
Location: Croatia
Posts: 4,689
|
you are da maaaaaaaan!!
|
|
|
09-24-2012, 02:51 PM
|
#17
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
Yes, but not realtime of course
Code:
cur = RPR_GetCursorContext()
if cur == 0: #panels
...do your actions....
elif cur == 1: #items
...do your actions....
elif cur == 2: #envelopes
...do your actions....
|
|
|
09-24-2012, 03:08 PM
|
#18
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
use RPR_Main_OnCommand(#,0)
within each condition, where # - number of action (i.e open toolbar)
|
|
|
09-24-2012, 03:13 PM
|
#19
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
gwok Please ignore this script. It won't work for you at the moment. I've just looked into the code and it was written very old and for my own project template.
I will make a new one
Veto, yeah probably
|
|
|
09-24-2012, 03:40 PM
|
#21
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
And if you already downloaded, pls download again, i've improved it a bit
Just select any items on any tracks and it will color all items on this tracks to one random color
https://stash.reaper.fm/v/14096/Rando...ted%20track.py
|
|
|
09-24-2012, 04:16 PM
|
#22
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
hey, thanks Viente - though I'm still getting an error
"Script execution error
Traceback (most recent call last):
File "Random color selected track.py", line 1
from reaper_python import *
^
SyntaxError: invalid syntax"
though I never use reascript, so maybe it is my configuration, and not your script. I'm on pre11, newest SWS, python 3.23.
Maybe I'll test some other scripts on the stash amd see if anything else works.
|
|
|
09-24-2012, 04:19 PM
|
#23
|
Human being with feelings
Join Date: Feb 2012
Posts: 1,972
|
A really weird behavior to be honest
it tells its error already in the first line which is
from reaper_python import *
|
|
|
09-24-2012, 04:23 PM
|
#24
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
ya, so it's probably my system. I'll test some other things and post back when I know whats up
thanks
|
|
|
10-27-2012, 11:36 AM
|
#25
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Awesome! Big ups, Veto! Those definitely looks small and simple enough to wrap my head around, so it looks like a perfect starting point for a bit of hacking. I owe you a beer or two. Or perhaps you prefer a good smoke, if you happen to come by Amsterdam some day.
I hope to have some time this weekend to study them more intensively (I'm currently on a flakey smartphone connection and have older versions of SWS - downloading new one now… slowly - and Python (2.7.2). And I think I should do a proper system backup before messing with that…)
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
10-27-2012, 04:47 PM
|
#26
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Quote:
Originally Posted by Veto
oh Banned wait a sec, before you're downloading hours for nothing, Python 2.7.2 wont work, sorry. There are some methods in the scripts which probably only work with the 3.x versions.
Just ask if you need help in any way about the scripts. And if you're like me, prefering a quantize dialog, be sure to check out that new script.
haha thanks i'm not such a big fan of both, but i'd love to see Amsterdam some day and when one happens to be in Amsterdam...
|
Let me know whenever you happen to be in the neighbourhood.
Yeah, I already had Python 2.7.2 installed (came with OS 10.8), but figured it might not work (and it didn't), so I grabbed the 3.2.3 version. But I couldn't get REAPER to work with it at first. In Preferences > ReaScript > Force Python to use dylib; I had entered
Code:
/Library/Frameworks/Python.framework/Versions/3.2/lib/libpython3.2.dylib
but REAPER told me its an incompatible version.
When I clicked the .dylib path button, the location of Python 2.x showed up - so I figured the description of Preferences > ReaScript > Custom path to dll directory must be wrong: on a Mac, there are typically no .dll files, so I started reading "dll" as ".dylib" instead. Then I removed the line from "Force Python to use dylib", and entered the path:
Code:
/Library/Frameworks/Python.framework/Versions/3.2/lib/
in the "Custom path to dll directory". Yay, REAPER now tells me: libpython3.2.dylib installed. (I have no idea why the first didn't work, but the second did. I tried this in both 32 and 64 bit versions of REAPER, with the same results. Perhaps this should be filed as a bug?)
However, I still get the same script execution error as before, it seems to fail to import the python functions from the SWS extension:
Code:
Traceback (most recent call last):
File "Quantize selected points.py", line 7, in <module>
from sws_python import *
ImportError: No module named sws_python
I do have SWS/S&M Extension 2.3.0 Build #7 installed now, btw. Perhaps I need a system reboot or such? I'll have another go at it tomorrow for sure. Also, staring at the code until it makes enough sense is already *very* useful for me at this point.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
10-28-2012, 05:19 AM
|
#27
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Quote:
Originally Posted by Veto
i'm sorry, i really wish i would actually know more than nothing about ReaScript on OS
I hope that some of the mac folks here can advise you with their experience.
Do you find a "sws_python.py" module in programs/REAPER/plugins (? for Mac).
Did you had the SWS module working with 2.7.2 ? If so, it would be no hassle to write the scripts to work with that version if thats okay.
Just out of interest, when Reaper says the py-lib is installed, does f.e.
PHP Code:
from reaper_python import * RPR_APITest()
gives you success?
Nevertheless i really think this qualifies as a bug on both sides, Reaper and SWS.
|
No, I had the same error when REAPER was using Python 2.7.2.
On my system that file is located here:
Code:
~/Library/Application Support/REAPER/Scripts/sws_python.py
There is a folder named "Plugins" only at:
Code:
/Applications/REAPER.app/Contents/Plugins
(But I don't think I'm supposed to mess with the contents of the app bundle, even though that might work as a workaround.)
A Test.py script containing just the lines you pasted works fine: "test ok".
No worries, I'm sure one of the Mac users will chime in at some point, and I'm not in a hurry. Thanks again for your help anyway, much appreciated.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
10-28-2012, 06:39 AM
|
#28
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
I guess it could be related to this: http://forum.cockos.com/showthread.p...cript sys.path
That is, it seems that Python does not know where to find sws_python.py, so I should somehow point it to ~/Library/Application Support/REAPER/Scripts/. I don't see a sys.path file anywhere here though.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
10-28-2012, 09:25 AM
|
#29
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
That one explains setting the path *to* Python, so the system (and REAPER) knows where to find Python. I already have that working, it seems. My problem is rather that Python can't find the modules in REAPER's "Scripts" folder, so I need to set the paths that Python itself uses. Another page linked from that one seemed more relevant though: http://www.ehow.com/how_10071616_mak...s-syspath.html. While it was helpful (I now at least know what my sys.path looks like, it is not a file), unfortunately it still did not solve the problem. I made a file named "path_to_sws_python.pth", containing the line
Code:
~/Library/Application\ Support/REAPER/Scripts
and placed in in the folder
Code:
/Library/Frameworks/Python.framework/Versions/3.2/lib/python3.2/
but it doesn't show that path when I quit and restart python and make it show sys.path again.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
10-28-2012, 09:35 AM
|
#30
|
Human being with feelings
Join Date: Nov 2007
Location: Cologne/Bishkek
Posts: 1,258
|
Reaper can render time selection, entire project, custom time range and project regions.
Isn't it possible to render/bounce each stem (selected track) in the right length/duration (tracklength in the arrangement window) with the help of some script?
(What we are getting now is: tracks all in duration of the longest track. Silence at the end of most tracks. Not useful).
|
|
|
10-28-2012, 01:01 PM
|
#31
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
Awesome, that works!
I'm sure I'll figure out what the problem is when I get a bit more comfortable with Python; as already noted, it may be just be a little bug somewhere. For now, at least I know how to work around the issue and start having some hacking fun.
Big thanks again for your help!
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
10-28-2012, 06:57 PM
|
#32
|
Human being with feelings
Join Date: Mar 2008
Location: Unwired (probably in the proximity of Amsterdam)
Posts: 4,868
|
[IMG]http://**************/a/img843/695/blushiesmall.png[/IMG]
Okay, after getting a bit more familiar with Python, it turns out that it was just a quite silly mistake on my part: when I unzipped your scripts, I had simply placed the resulting *folder* in /Scripts, so they actually were *not* in the exact same folder as sws_python.py, as required. Dragging them one level up solved the error. Anyway, making such silly mistakes is an essential part of learning.
</blush>
Before trying to expand its functionality (I already have a couple of ideas to keep me motivated to dig in further), I'm now trying to get a bit more familiar with the syntax first. Modifying your script to my style preferences was a great exercise. I should probably do a few tutorials and get a bit more familiar with the Python standard library and specifics of ReaScript next.
Btw, Live 9 will also get automation curves, but will apparently not yet have quantisation for automation values. Thanks for helping keep REAPER yet another step ahead of the curve.
__________________
˙lɐd 'ʎɐʍ ƃuoɹʍ ǝɥʇ ǝɔıʌǝp ʇɐɥʇ ƃuıploɥ ǝɹ,noʎ
|
|
|
11-04-2012, 08:10 PM
|
#33
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
not sure if this is possible with reascript, or if someone could\would do it, though this action would be really useful
"open new project tab with current projects' bpm\time signature'
possible with reascript?
|
|
|
11-05-2012, 07:18 PM
|
#34
|
Human being with feelings
Join Date: Jun 2009
Location: Earth
Posts: 1,340
|
@gwok,
I'm 99.9% sure it's possible. I'm not on my REAPER machine right now so I can't test it out. If no one else posts a solution I'll see what I can cook up and post either late tonight or possibly tomorrow.
|
|
|
11-05-2012, 08:11 PM
|
#35
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
@Anton9
that would be awesome man, thanks! no rush here - (workin 120bpm atm )
|
|
|
11-07-2012, 01:33 AM
|
#36
|
Human being with feelings
Join Date: Jun 2009
Location: Earth
Posts: 1,340
|
@gwok,
Ok so I messed around a little bit and this is what I came up with.
It's not the best solution, but it does work. What this script does is it will get the time sig. and BPM at the edit cursor position(this is handy if your project has any tempo/time sig. changes). It then creates a new project tab and sets it's time sig and BPM to match. However because the ReaScript API does'nt have a function for setting the time sig of a project directly without adding a time sig marker the new project tab will include a time sig marker at the begining. I'm going to put in a request to the devs for a set project time sig function and if it's added I'll update the script.
You may also notice in the script there are commands that switch to the previous project tab and then back to the new one.., these had to be added because the transport does'nt refresh with the settings contained in the time sig. marker until playback occurs or like I discovered until you switch tabs. The switch happens really fast so you should'nt even really notice it.
I did come up with another way of creating a new project based on current projects time/BPM using the SNM_SetIntConfigVar() and SNM_SetDoubleConfigVar() functions which would'nt require a marker being added to the new project. However it also has a transport refresh issue so I'm not posting that script for now.
Code:
# TEST (Gets Time sig. and Tempo at cursor position then creates a new project tab with these settings.)
curProj = 0
CurPos = RPR_GetCursorPosition()
Tnum = 0 # Time sig. numerator
Tdnom = 0 # Time sig. denominator
BPM = 0
x = RPR_TimeMap_GetTimeSigAtTime(curProj, CurPos, Tnum, Tdnom, BPM) # Gets the time sig. and BPM of current project at cursor position
RPR_Main_OnCommand(40859,0) #Creates new project tab
RPR_SetTempoTimeSigMarker(0, -1, 0, 0, 0, x[4], x[2], x[3], 0) # Sets new project tabs time sig. and BPM
RPR_UpdateTimeline() #Updates the timeline
RPR_Main_OnCommand(40862, 0) # Previous project tab
RPR_Main_OnCommand(40861, 0) # Next project tab
|
|
|
11-07-2012, 10:47 AM
|
#37
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
Thanks Anton9, so far it's working great. Just had a chance to test quick, but it's totally solid, and I don't see any issues caused by recalling the original tab for that refresh issue.
great stuff, thanks again
g
|
|
|
11-13-2012, 02:40 PM
|
#38
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
another request in the tempo\time sig vein if anyone is up to it. Store and recall tempo\time sig actions.
So in one tab the settings can be stored, then in another hit load\recall and the settings are set.
thanks,
g
|
|
|
11-14-2012, 01:34 AM
|
#39
|
Human being with feelings
Join Date: Jun 2009
Location: Earth
Posts: 1,340
|
Hey gwok,
Well thanks to a tip from Jeffos I am now posting the other script I mentioned. It basically does the same thing as the other one except it does'nt put a time sig marker in the new project and it also does'nt rely on the tab switch trick. If I get some time I'll have a try at your other request.
Code:
#Copies the time sig and BPM at the edit cursor's position and creates a new project with these settings
from sws_python import *
curProj = 0
CurPos = RPR_GetCursorPosition()
Tnum = 0 # Time sig. numerator
Tdnom = 0 # Time sig. denominator
BPM = 0
x = RPR_TimeMap_GetTimeSigAtTime(curProj, CurPos, Tnum, Tdnom, BPM) # Gets the time sig. and BPM of current project at cursor position
RPR_Main_OnCommand(40859,0) #Creates new project tab
SNM_SetIntConfigVar("projmeaslen", x[2]) #Sets the new projects time sig numerator
SNM_SetIntConfigVar("projtsdenom", x[3]) #Sets the new projects time sig denominator
RPR_SetCurrentBPM(0, x[4], False) #Sets the new projects BPM
|
|
|
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 09:34 PM.
|