|
|
|
10-16-2014, 11:49 AM
|
#641
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by vanhaze
Ola to all !
Can someone maybe write a script to split an Item (be it Audio or Midi) exactly in half ?
So, let's say i have a Midi item which is 2 bars long.
The wished for script will, when exectued, split this into 2 new Midi items, each 1 bar long.
Or does such a script maybe already exist ?
Many thanx in advance !
|
Hi
Split selected items at midpoint.eel
https://stash.reaper.fm/22115/Split%2...20midpoint.eel
|
|
|
10-16-2014, 01:10 PM
|
#642
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Insane !!! Thx !!
|
|
|
10-18-2014, 10:52 AM
|
#643
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Triode
A script which does the following would be really handy:
Duplicate tracks (without items) and clone their group settings to the next free group.
With multi-mic recording setups I often have various master/slave group settings that I want to preserve but in a new group for the new tracks.
There are several sws actions that might come in handy for the script: copy selected track grouping / paste grouping to selected tracks. These only work for individual settings per track, ie: they can't transfer more than one array of settings at the same time but a script could use the action per duplicated track.
Many thanks in advance :-)
|
I made a script, but I noticed that it's not possible to copy group parameters between groups (f.ex from group 1 to group 2).
So, this is only a "half-working" script
https://stash.reaper.fm/22135/Duplica...w%20groups.eel
|
|
|
10-18-2014, 01:51 PM
|
#644
|
Human being with feelings
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
|
spk77 why this?
PHP Code:
id_array = 10000;
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
|
|
|
10-18-2014, 03:05 PM
|
#645
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by Argitoth
spk77 why this?
PHP Code:
id_array = 10000;
|
Here's a quote from Bernstraw's post:
2) Arrays.
There is only one array available, its index goes from 0 to 8388607.
You have to define in @init where your sub-arrays will be located (their offset) in this big array.
Code:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 ... 8388607
\____ Xcoord ____/\____ Ycoord ____/\_____ next_array _____/
* Xcoord[...] starts at index 0 and has 6 slots.
* Ycoord[...] will have to start at index 6 and is also 6 slots long.
* next_array[...] (8 slots) starts at 12.
Here's how to do it :
Code:
@init
Xcoord = 0 ;
Ycoord = 6 ;
next_array = 12 ; // offset is given by the size of previous arrays.
@ block
// You can now use them like normal arrays.
i = 0 ;
loop(6,
Xcoord[i] = 16*i ;
Ycoord[i] = rand(128) ;
i+=1 ;
);
next_array[0] = rand(16);
http://forums.cockos.com/showpost.ph...37&postcount=9
So, 10000 is just a "random" valid offset.
|
|
|
10-18-2014, 04:38 PM
|
#646
|
Human being with feelings
Join Date: Feb 2008
Location: Mesa, AZ
Posts: 2,057
|
Quote:
So, 10000 is just a "random" valid offset.
|
right right.
__________________
Soundemote - Home of the chaosfly and pretty oscilloscope.
MyReaperPlugin - Easy-to-use cross-platform C++ REAPER extension template
|
|
|
10-18-2014, 08:18 PM
|
#647
|
Human being with feelings
Join Date: Nov 2010
Posts: 2,436
|
This is the best quote about JS/EEL arrays ever:
Quote:
Originally Posted by Banned
Just remember, arrays in EEL are like Highlander: "there can be only one."
|
Last edited by Breeder; 10-18-2014 at 08:25 PM.
|
|
|
10-19-2014, 07:41 AM
|
#648
|
Human being with feelings
Join Date: Jan 2012
Posts: 1,180
|
Quote:
Originally Posted by spk77
|
Thanks for giving it a go anyway.
|
|
|
10-20-2014, 11:27 AM
|
#649
|
Human being with feelings
Join Date: Sep 2012
Location: Brooklyn
Posts: 1
|
Record on Transient Detection
Hi, I'm a long time lurker. Just now finding out about the power of ReaScript and I am amazed and excited about the possibilities. The script I'd like to write functions like this:
If an armed track receives audio input over a specified threshold(e.g. -12.0 Db), it records a clip for a specified time (e.g. 5 minutes) BONUS have the clip preroll for 10 seconds.
Is this too complicated for a newbie? Is this already implemented in the actions list? Is there any threads you can suggest I look at to get a better idea of how this would work?
Thanks so much for your time.
|
|
|
10-21-2014, 07:29 AM
|
#650
|
Human being with feelings
Join Date: Oct 2014
Posts: 3
|
I would like a script (or plug-in, if somebody knows of something that can already do this) that does the following:
For each MIDI note received, compare the pitch with the previous note. If the interval is below a user-specified threshold (in semitones), pass it on.
If the interval is above the threshold, wait a user-specified amount of time (range about 1 to 100 milliseconds). If no new note is received within the time limit, pass the note on. If a new note is received within the time limit, discard the note that's "paused", and pass on the new note.
Background information: Using the Akai EWI wind controller, you change octaves by using a series of thumb rollers. When you play across the octave, if your thumb roll is not precisely co-ordinated with your note fingering, you get a very obvious and objectionable "blip" - a little grace note that's an octave above or below the intended note.
Can anybody help with this?
|
|
|
10-21-2014, 09:56 AM
|
#651
|
Human being with feelings
Join Date: Aug 2012
Location: Finland
Posts: 2,668
|
Quote:
Originally Posted by playitbackwards
Hi, I'm a long time lurker. Just now finding out about the power of ReaScript and I am amazed and excited about the possibilities. The script I'd like to write functions like this:
If an armed track receives audio input over a specified threshold(e.g. -12.0 Db), it records a clip for a specified time (e.g. 5 minutes) BONUS have the clip preroll for 10 seconds.
Is this too complicated for a newbie? Is this already implemented in the actions list? Is there any threads you can suggest I look at to get a better idea of how this would work?
Thanks so much for your time.
|
Hi,
We can't manipulate/get the audio stream with ReaScript Python/EEL - I'm afraid that this is not possible.
... If an armed track receives audio input over a specified threshold(e.g. -12.0 Db)...
This part is possible with JSFX, but I'm not sure if JSFX is capable to trigger actions from the action list (the script could for example trigger the action - Transport: Record when input > -12dB etc.).
There's this little "gap" between ReaScript and JSFX
Quote:
Originally Posted by Oldguy
I would like a script (or plug-in, if somebody knows of something that can already do this) that does the following:
For each MIDI note received, compare the pitch with the previous note. If the interval is below a user-specified threshold (in semitones), pass it on.
If the interval is above the threshold, wait a user-specified amount of time (range about 1 to 100 milliseconds). If no new note is received within the time limit, pass the note on. If a new note is received within the time limit, discard the note that's "paused", and pass on the new note.
Background information: Using the Akai EWI wind controller, you change octaves by using a series of thumb rollers. When you play across the octave, if your thumb roll is not precisely co-ordinated with your note fingering, you get a very obvious and objectionable "blip" - a little grace note that's an octave above or below the intended note.
Can anybody help with this?
|
This should be possible with JSFX (I don't know much about JSFX, but there are many people in this forum who might know how to make this JSFX).
|
|
|
10-21-2014, 12:40 PM
|
#652
|
Human being with feelings
Join Date: Oct 2014
Posts: 3
|
I hope so.
Actually, since posting this, I've thought of lots of circumstances where doing this would actually make matters worse: If your intention was to play a D in the second octave followed by a G in the first octave and your thumb roll was late, then the "blip" note would only be five semitones away from the D, whereas the low G that you intended to play would be a whole octave away from the blip note, so the blip note would actually get held and be even more obvious.
Nevertheless, if somebody would be willing to help make this, I'd still like to try it.
|
|
|
10-30-2014, 12:44 PM
|
#653
|
Human being with feelings
Join Date: Mar 2012
Posts: 13
|
LOSER/Exciter
Hello there,
I'm wondering if it would be possible to add a low-pass filter to the "LOSER/Exciter" plug in. Ideally, the LPF would go immediately after the HPF (before the harmonics are added). This would allow a little bit more control of the harmonics that are synthesized. How difficult would this be to do?
Thank you so much!
|
|
|
11-27-2014, 09:07 AM
|
#654
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
Filled polygons for JS
It would be great if anyone had fast routines for these.
Just triangles is OK, quads even better. Arbitrary polygons would of course be great
|
|
|
11-27-2014, 10:37 AM
|
#655
|
Human being with feelings
Join Date: Jul 2013
Posts: 121
|
I wonder if it's possible to make a script that pastes envelopes always like the first time and not the second time:
It should probably do something like:
1. add an envelope point immediately after the cursor, equal to the value of the envelope at the cursor, if there isn't already an eenvelope point at the cursor
2. copy all the other points immediately afterwards
If noone can help I'm going to try to learn reascript and do it
|
|
|
11-27-2014, 11:02 AM
|
#656
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
Quote:
Originally Posted by mete0r
I wonder if it's possible to make a script that pastes envelopes always like the first time and not the second time:
It should probably do something like:
1. add an envelope point immediately after the cursor, equal to the value of the envelope at the cursor, if there isn't already an eenvelope point at the cursor
2. copy all the other points immediately afterwards
If noone can help I'm going to try to learn reascript and do it
|
Looks like a bug to me. I would post it on the Bug Report forum:
http://forum.cockos.com/forumdisplay.php?f=22
|
|
|
11-27-2014, 11:21 AM
|
#657
|
Human being with feelings
Join Date: Jul 2013
Posts: 121
|
Thank you, I posted a bug report.
|
|
|
12-02-2014, 03:37 AM
|
#658
|
Human being with feelings
Join Date: Nov 2014
Posts: 194
|
i think a scrip for routing tracks to analog outputs would be wonderful.
If you work on a hybrid setup with lots af AD/DA channels on your converter it would be very handy to flip a track from, for example parent to output 5/6
So the script would have to select a specified hardware output while disabling other hardware outs but remaining sends.
Then a series of scripts could be adapted for each output and recalled via keystrokes.
Another script for selecting inputs imediately comes to mind...
What do you think?
|
|
|
12-02-2014, 04:49 AM
|
#659
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
|
Run this little EEL utility, you might need to drag-out the window vertically if you have items in the track (in fact try it on an empty track).
https://stash.reaper.fm/22468/show_trackstate.eel
It lists the selected track's "Trackstate". What I'm looking for is the line: " HWOUT", when you have the hardware sends enabled that you're trying to set with a script. Mine says " HWOUT 0 0 1 0 0 0 0 -1 -1", but I'm on a laptop and only have two outputs to play with. It might say 2 for the first parameter, or 1026 or something -I'm not near my workstation so I can't check it out. The 0 on mine signifies outputs 1&2 (default).
Once I know what to write to it, it should be relatively straightforward. I might have time today or tomorrow to write an action.
>
|
|
|
12-02-2014, 09:39 AM
|
#660
|
Human being with feelings
Join Date: Nov 2014
Posts: 194
|
Hello Planetnine,
Thanks for the hint!
I am running the eel script and indeed it is showing me different code for different hardware outs!
Now i need to learn how to write to the track.
Last edited by jrp; 12-02-2014 at 09:45 AM.
|
|
|
12-02-2014, 11:13 AM
|
#661
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
|
Quote:
Originally Posted by jrp
...
I am running the eel script and indeed it is showing me different code for different hardware outs!
Now i need to learn how to write to the track.
|
String manipulation. Read it in as lines and match for "HWOUT"
>
|
|
|
12-02-2014, 12:24 PM
|
#662
|
Human being with feelings
Join Date: Nov 2014
Posts: 194
|
sorry, i´m a bit lost (simply new to this...)
I have found this in another forum post.
tr = RPR_GetSelectedTrack(0, 0)
RPR_SetMediaTrackInfo_Value(tr, "I_RECINPUT", -1) # Input: None
It sets the input to none.
With
"I_RECINPUT", 0)
"I_RECINPUT", 1)
"I_RECINPUT", 1024) i can select input 1,2 or 1+2
That´s great!
I was hoping that changeing I_RECINPUT to I_HWOUT was all that´s needed, but it doesn´t do anything, no matter what number i put in...
|
|
|
12-02-2014, 01:19 PM
|
#663
|
Human being with feelings
Join Date: Oct 2007
Location: Lincoln, UK
Posts: 7,924
|
Just bear it in mind that your example is written in Python, which is the other language that ReaScript is written in -you will need Python installed on your machine and REAPER recognising it to use Python scripts. EEL is a simpler language, but it's native.
That out of the way, I_RECINPUT is one of the parameters settable with SetMediaTrackInfo_Value, but HWOUT is unfortunately not. You will have to use GetSetTrackState2 to set HWOUT instead, it's a little more complicated
>
|
|
|
12-02-2014, 01:32 PM
|
#664
|
Human being with feelings
Join Date: Nov 2014
Posts: 194
|
even more complicated...
python seems to be running fine, i was able to test and use the example above.
I cannot find any info on GetSetTrackState2 though...
|
|
|
12-03-2014, 08:14 AM
|
#665
|
Human being with feelings
Join Date: Jan 2011
Posts: 284
|
SWING FOR AUDIO script pls )
|
|
|
12-15-2014, 02:59 AM
|
#666
|
Human being with feelings
Join Date: Nov 2013
Location: Argentina
Posts: 326
|
Action to load Keymaps
Hi awesome people whit coding skills!
It's too hard to code a set of actions to load keymaps? Like load keymap 1, keymap 2, keymap 3, etc.
When composing, hands on midi keyboard, i don't like at all modifiers, like control, shift, etc. It's my left hand doing the work, and she don't like it.
In extent some combinations are too far apart.
I want the functions lie down totally exposed on the keys without modifiers. Like tap tempo, add V.I, loop item, loop 1 bar, two bars, 4 bars, grid to 1, 1-2, 1-4, etc, goto here, goto there, transpose, cut, fit, solo, mute, and all the things i can come up knowing i can devote all the keys on the laptop to a specific task.
And the same for editing, and for mixing.
Little stupid example. When I'm in editing mode, i want "asdfg" like protools, or something like, so accustomed to that. But when my hands are on the midi keyboard, i don't want the "s" key to split items, i want it to solo tracks. In editing context i want "f" to open fade settings. Composing, i want "f" to bring the fx.
And to change the configs on the fly with a keystroke or a toolbar button, make it 100x times more useful than the current option to change it thru the menus, and doesn't seem so ridiculous hard to implement.
Edit - Maybe with some configuration window, like the sws resources. You set there your keymaps to actions configurations, and later reacall them via actions-Keystrokes.
Edit 2 - Maybe this is an sws request?
__________________
Living la vida loca
Last edited by Pasajeromoronmoreno; 12-15-2014 at 05:21 AM.
|
|
|
12-16-2014, 12:29 AM
|
#668
|
Human being with feelings
Join Date: Jan 2011
Posts: 284
|
Quote:
Originally Posted by kuus0
|
this plugin is awesome but it is for MIDI only ((
i need for AUDIO.
|
|
|
12-16-2014, 02:02 PM
|
#669
|
Human being with feelings
Join Date: Feb 2011
Posts: 159
|
Quote:
Originally Posted by andivax
this plugin is awesome but it is for MIDI only ((
i need for AUDIO.
|
Sorry my mistake. I tought it was for audio. Now I have to close the tab...
|
|
|
12-19-2014, 03:51 PM
|
#670
|
Human being with feelings
Join Date: Sep 2011
Posts: 196
|
Render master mix to specific track
Hi everyone,
Does anyone know if I can use reascript to render the master output and add it as a take in a track called "Roughmix"? Preferably also putting the file in a subfolder with the same name within the project folder.
Tried to look in the reascript docs but couldn't find any suitable render function for my use.
|
|
|
12-22-2014, 10:08 AM
|
#671
|
Human being with feelings
Join Date: Dec 2014
Posts: 36
|
Hi, script makers !
I'm new in Reaper, but not in music with pc.
I don't know exactly which are the Reaper script limits.
I'd like to have a drawing tool for midi CC in midi editor. I'm a bit disapointed to have only the possibility to draw lines and no curve.
Would this be possible with some script ?
I'm a bit surprised to not find any request about this, indeed. This feature is missing, at least for me...
But never mind because some script genius is going to build this feature ! Hmmm...
Thanks for your attention.
__________________
Musica ! →here←
|
|
|
12-22-2014, 07:46 PM
|
#672
|
Human being with feelings
Join Date: Dec 2014
Posts: 36
|
I need an other script indeed !
I would like, thanks to a shortcut, to display envelope curves corresponding to 1°, 2°, 3° FX parameter of a track.
For instance, alt+1 -> reacontrolmidi fx CC 11 ; alt+2 -> reacontrolmidi fx CC21 ; alt+3 -> reacontrolmidi fx CC23 and so on. Depending how and which fx is in use.
A shortcut, you edit this fx envelope/automation curve, with an other shorcut, an other fx envelope/automation curve...
I thought I was going to find it in SWS extension, but ... No ....
Do you think it's possible (and surely easier than midiCC curve drawing curve )
Thanks !
__________________
Musica ! →here←
|
|
|
01-09-2015, 02:21 PM
|
#673
|
Human being with feelings
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
|
Transient marker on every beat.
So i do alot of producing megamixes of old disco tracks, (which have 4 to the floor rhythms) which, ofcourse, don't have steady tempo's.
You can imagine i have to fiddle alot with setting transient markers in a disco track, to quantize it correctly to grid, to be able to make steady sounding mixex between 2 disco tracks.
My wish would be having a script that can set a transient marker just on every beat of a disco track,no more and no less.
The dynamc split window and it's options to achieve this is to cumbersome for me, sorry.
i am thinking about the procedure for achieving this;
Let's say you have to set the first transient for the very first kickdrum in a discotrack.
And then apply the script.
The script has to search the whole track for similar transients and set a transient marker at those similar transients
It also has to detect a regular time interval between those transients, and only create transient markers at those places.(remember? : 4 to the floor rhythms).
Meaning, there can be kickdrums in between 2 beats but setting transient markers for these kickdrums is wrong cause the time interval doesn't match the "regular" detected time interval between two kickdrum transients, belonging to the "4 to the floor rhythm)
Is this a totally wrong and way too simplified philosophy ?
If not, can such a script be made ?
I would pay for it generally .. !
|
|
|
01-10-2015, 11:59 PM
|
#674
|
Human being with feelings
Join Date: Jun 2010
Location: canada
Posts: 3,396
|
Hey guys,
would anyone be into whipping up a couple small scripts potentially?
What I'm looking for is a script to select what I call "sub-parents". That is parents within a folder already. I want to select parents within folders for various actions, ie color/layouts, and it is quite tricky to simple select parent tracks within folders with the current actions, without selecting the uppermost parent in the hierarchy.
If it's possible, what I'm looking for are 2 actions
•select all sub-parents_global - this will select all sub-parent tracks in the entire project, but not the uppermost parent in the hierarchy
•select all sub-parents in selected folder track - this would select only sub parents within the currently selected folder track
does that make sense? if so, and someone is into it, thanks in advance!
|
|
|
01-14-2015, 01:42 PM
|
#675
|
Human being with feelings
Join Date: Feb 2012
Location: Canada
Posts: 35
|
Add Silence between multiple items
Is it complex to create a script that does the following?
Let's suppose I import 200 files in the timeline, all in the same track, all the items are automatically edited back to back by default.
I would need a script that given a nudge value (in seconds or frames preferably) ripple move the items leaving that amount of silence between them.
I'm doing this with a macro now but when I have to do it for many items is a never-ending clicking.
If the script already exist somewhere please point me to it, I couldn't find anything like that in the stash.
Thank you very much for your help.
|
|
|
01-14-2015, 04:51 PM
|
#676
|
Human being with feelings
Join Date: Sep 2009
Location: Virginia
Posts: 2,067
|
Quote:
Originally Posted by Edufighter
Is it complex to create a script that does the following?
Let's suppose I import 200 files in the timeline, all in the same track, all the items are automatically edited back to back by default.
I would need a script that given a nudge value (in seconds or frames preferably) ripple move the items leaving that amount of silence between them.
I'm doing this with a macro now but when I have to do it for many items is a never-ending clicking.
If the script already exist somewhere please point me to it, I couldn't find anything like that in the stash.
Thank you very much for your help.
|
Here's a demo of 2 seconds between items.
Save as eel or see attached.
Code:
itemCount = CountSelectedMediaItems(0);
itemIndex = 0;
while (itemIndex < itemCount)(
item = GetSelectedMediaItem(0, itemIndex);
position = GetMediaItemInfo_Value(item, "D_POSITION");
position = position + (2*itemIndex);
SetMediaItemPosition(item, position, 0);
itemIndex = itemIndex + 1;
);
UpdateArrange();
On this line:
Code:
position = position + (2*itemIndex);
2 is the amount of secs
For frames you could: e.g cd frames (75) or whatever your framesize.
Code:
framesize = 1.0 / 75.0;
and put framesize in place of 2.
Code:
position = position + (framesize*itemIndex);
that would give 1 frame between items.
This is just a demo. Might have to add other stuff, like select all items.
Let me know what you need, and I'll try and put something together.
Regards, Wyatt
Last edited by WyattRice; 01-14-2015 at 05:48 PM.
|
|
|
01-14-2015, 09:35 PM
|
#677
|
Human being with feelings
Join Date: Feb 2012
Location: Canada
Posts: 35
|
Thanks a lot WyattRice!, I'll give it a try right away.
is there a way to get prompted to input the value in seconds using a pop-up window and replace that variable for the 2 in here?
position = position + (2*itemIndex);
The part of "selecting all the items in the selected track" I can add it using your script as part of a macro that I will assign later to a button in my toolbar.
Cheers,
EDIT: I've tried it and it didn't work some items move, other didn't move and the gap between the items was strange like incremental for every item.
Eduardo
Last edited by Edufighter; 01-14-2015 at 09:49 PM.
|
|
|
01-15-2015, 03:27 AM
|
#678
|
Human being with feelings
Join Date: Jul 2013
Posts: 121
|
I tried to do it in lua, I think it should work.
At the top you have the values you can change, with an explaination of what they do.
You have to select all the media in the track, then run this script.
Code:
-- edit these values to change behaviour
-- If you want to use frames, set this to false
-- If you want to use seconds, set this to true
useSeconds = false
-- How many seconds between the items?
nudgeAmountInSeconds = 2
-- How many frames between the items?
nudgeAmountInFrames = 60
-- How many seconds is a frame? I don't actually know what a frame is :P
-- If it's a frame as in video frame, this should work for 60 fps
secondsPerFrame = 1.0 / 60.0
-- do not touch below
function spairs(t, order)
-- collect the keys
local keys = {}
for k in pairs(t) do keys[#keys+1] = k end
-- if order function given, sort by it by passing the table and keys a, b,
-- otherwise just sort the keys
if order then
table.sort(keys, function(a,b) return order(t, a, b) end)
else
table.sort(keys)
end
-- return the iterator function
local i = 0
return function()
i = i + 1
if keys[i] then
return keys[i], t[keys[i]]
end
end
end
local timePointerIncrement
if useSeconds then
timePointerIncrement = nudgeAmountInSeconds
else
timePointerIncrement = secondsPerFrame * nudgeAmountInFrames
end
local selectedItemsNum = reaper.CountSelectedMediaItems(0)
local timePointer = 0
local items = {}
for i = 0, selectedItemsNum - 1 do
items[i+1] = reaper.GetSelectedMediaItem(0, i)
end
-- Sort items based on their position
table.sort(items, function(a,b) return reaper.GetMediaItemInfo_Value(a, "D_POSITION") < reaper.GetMediaItemInfo_Value(b, "D_POSITION") end)
for i = 1, #items do
local item = items[i]
local itemLen = reaper.GetMediaItemInfo_Value(item, "D_LENGTH")
reaper.SetMediaItemInfo_Value(item, "D_POSITION", timePointer)
timePointer = timePointer + timePointerIncrement + itemLen
end
|
|
|
01-15-2015, 07:37 AM
|
#679
|
Human being with feelings
Join Date: Feb 2012
Location: Canada
Posts: 35
|
Thanks mete0r!
How can I use .lua scripts in Reaper? AFAIK it recognizes only python and .eel
I'm getting a "extension not supported .lua" message in the console.
Cheers.
Eduardo
|
|
|
01-15-2015, 07:49 AM
|
#680
|
Human being with feelings
Join Date: Jul 2013
Posts: 121
|
... whoops, sorry. Lua works on v5 prerelease only
I erased a bit of code that I copypasted by error, but essentially, the difference between my lua code and the previous eel code you had, is this:
Code:
-- Sort items based on their position
table.sort(items, function(a,b) return reaper.GetMediaItemInfo_Value(a, "D_POSITION") < reaper.GetMediaItemInfo_Value(b, "D_POSITION") end)
It sorts the selected items by position (it seems that they are not returned in this order in the list of selected items) before applying the spacing.
In lua it's extremely easy, but I don't know eel and I wouldn't know how to do it, sorry.
This is the code without the unused function if someone wants to try to translate it to eel (but I suspect the problem is that table.sort)
Code:
-- edit these values to change behaviour
-- If you want to use frames, set this to false
local useSeconds = false
-- How many seconds between the items?
local nudgeAmountInSeconds = 2
-- How many frames between the items?
local nudgeAmountInFrames = 60
-- How many seconds is a frame? I don't actually know what a frame is :P
-- If it's a frame as in video frame, this should work for 60 fps
local secondsPerFrame = 1.0 / 60.0
-- do not touch below
local timePointerIncrement
if useSeconds then
timePointerIncrement = nudgeAmountInSeconds
else
timePointerIncrement = secondsPerFrame * nudgeAmountInFrames
end
local selectedItemsNum = reaper.CountSelectedMediaItems(0)
local timePointer = 0
local items = {}
for i = 0, selectedItemsNum - 1 do
items[i+1] = reaper.GetSelectedMediaItem(0, i)
end
-- Sort items based on their position
table.sort(items, function(a,b) return reaper.GetMediaItemInfo_Value(a, "D_POSITION") < reaper.GetMediaItemInfo_Value(b, "D_POSITION") end)
for i = 1, #items do
local item = items[i]
local itemLen = reaper.GetMediaItemInfo_Value(item, "D_LENGTH")
reaper.SetMediaItemInfo_Value(item, "D_POSITION", timePointer)
timePointer = timePointer + timePointerIncrement + itemLen
end
|
|
|
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 07:11 AM.
|