Old 04-09-2014, 03:56 PM   #1
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default Convert loops to real copies

Possible?
Viente is offline   Reply With Quote
Old 04-09-2014, 07:44 PM   #2
ashcat_lt
Human being with feelings
 
Join Date: Dec 2012
Posts: 7,295
Default

Yes?

Wait, what's the question?
ashcat_lt is online now   Reply With Quote
Old 04-09-2014, 07:50 PM   #3
James HE
Human being with feelings
 
James HE's Avatar
 
Join Date: Mar 2007
Location: I'm in a barn
Posts: 4,467
Default

loops of what?

audio?

midi?

froot?

*burp. I ate teh froot loops

Last edited by James HE; 04-11-2014 at 07:18 AM.
James HE is offline   Reply With Quote
Old 04-09-2014, 09:37 PM   #4
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Exuse me for such a short question. I mean when you loop an item, is it possible to convert all loop segments to individual items, the same as in Logic Pro for example.
Viente is offline   Reply With Quote
Old 04-09-2014, 10:11 PM   #5
EricM
Human being with feelings
 
EricM's Avatar
 
Join Date: Jul 2009
Location: Ljubljana, Slovenia
Posts: 3,801
Default

Create a new item out of the looped item? Glue it to itself.

Edit: Ah you probably mean create instances of each loop
into individual items. Not sure, maybe with a certain sws
action, don't think it's possible natively.

e
__________________
Shoelace 4 Theme | SoundCloud/erXon
EricM is offline   Reply With Quote
Old 04-10-2014, 01:13 AM   #6
hamish
Human being with feelings
 
hamish's Avatar
 
Join Date: Sep 2007
Location: The Reflection Free Zone
Posts: 3,026
Default

glue is the correct answer
hamish is offline   Reply With Quote
Old 04-10-2014, 03:21 AM   #7
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 11,359
Default

Glue creates one long item instead of individual items for each iteration. What's needed is more like "split item at take loop positions and probably also "Glue to individual items". Both are not available yet.

It's not possible with onboard tools. Maybe because different takes can have individual loop length, there is no "move cursor to next/previous take loop position" like action you could use to then split the item or whatever you wish to do there. Would be a useful action. I don't think SWS has it either.

Good candidate for a ReaScript, the function as a whole. I can already find the loop positions of the active take with audio sources, but with MIDI it turns out to be not as reliable (MIDI source lengths are rounded to MIDI ticks) and I wouldn't know what to do if you wanted pooled copies as a result (like Logic's "Convert loops to aliases").
gofer is offline   Reply With Quote
Old 04-10-2014, 04:03 AM   #8
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

I found a way to do it. Not very elegant, though.

The first macro is needed to get the time selection of a single loop iteration.
The second one moves the time selection right by it's length and splits the item.
If you assign a shortcut to it and keep it pressed, this macro can be pretty fast.





Edit:
After splitting you can run the action 'render as new take' if you want.
(Seems to work only for audio items.)

Edit 2:
If you remove 'loop item source' from the first macro, it should also work for midi items.

Last edited by witti; 04-10-2014 at 04:14 AM.
witti is offline   Reply With Quote
Old 04-10-2014, 05:13 AM   #9
vordex
Human being with feelings
 
vordex's Avatar
 
Join Date: Sep 2013
Location: Oxfordshire, UK
Posts: 60
Default

Quote:
Originally Posted by Viente View Post
I mean when you loop an item, is it possible to convert
Cut away the repeats, (so the loop is just the first item) then copy it (Ctrl+C in Windows), then just click paste as many times as you want (Ctrl+V)... does that do what you want?
vordex is offline   Reply With Quote
Old 04-10-2014, 05:41 AM   #10
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Copy and paste (or duplicate item) also pastes/duplicates the track envelope points, if there are any. (unless you've un-ticked: move envelope points with items). It's also not the easiest task to select the exact area of the portion you want to cut away because the edit cursor or time selection is not snapping to a take loop position. That's why i've created the macros this way.

(Is there a way to get the number of loop iterations with reascript, or better eel ?)

Last edited by witti; 04-10-2014 at 03:00 PM.
witti is offline   Reply With Quote
Old 04-10-2014, 09:13 AM   #11
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Thanks! I'll try to improve your custom action with EEL script as soon as i figure out new syntax (i was used Python before)
Viente is offline   Reply With Quote
Old 04-10-2014, 03:39 PM   #12
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 11,359
Default

There seems to be a problem with "Set item length to source media length" when the first loop iteration is not complete (if the left item edge is not on the take section loop border). The action crops the item to the partial loop iteration. I don't think that's intended. I didn't try Witti's macro, but think it breaks under this circumstance.

Turned out I needed to find a way around several cliffs in the script. EG, MIDI sources behave different from audio when the take has a playrate other than 1, and for both weird values can occur for "Start in source" which the script depends upon. But I think this version is working - apart from a glitch with undo. For some reason I never seem to get undo right ... This script for some reason creates two undo points in the history.

Please test if interested or take as a source for your own ideas: (edit: damn it fails with MIDI when tempo changes are in the way. yuck.)

Code:
#---convert looped takes into individual items for each iteration---

cursorPos = RPR_GetCursorPositionEx(0)
RPR_PreventUIRefresh(1)
selCountA = RPR_CountSelectedMediaItems(0)
selList = []
k = 0
RPR_Undo_BeginBlock2(0)
while k < selCountA:
	it = RPR_GetSelectedMediaItem(0, k)
	selList.append(it)
	k += 1
itemList = selList
RPR_Main_OnCommand(40289, 0) # unselect all

for i in range(selCountA):
	RPR_SetMediaItemSelected(selList[i], 1)
	selCount = RPR_CountSelectedMediaItems(0)
	item = RPR_GetSelectedMediaItem(0,0)
	take = RPR_GetActiveTake(item)
	src = RPR_GetMediaItemTake_Source(take)
	rate = RPR_GetMediaItemTakeInfo_Value(take, "D_PLAYRATE")
	StartOffs = RPR_GetMediaItemTakeInfo_Value(take, "D_STARTOFFS")
	ItemStart = RPR_GetMediaItemInfo_Value(item, "D_POSITION")
	retval, src, offsOut, lenOut, revOut = RPR_PCM_Source_GetSectionInfo(src, 0, 0, 0)
	(src, type, bufsize) = RPR_GetMediaSourceType(src, "", 5)
	if type == "MIDI":
		loopLen = lenOut
	else:
		loopLen = lenOut/rate
	Pos = (ItemStart + loopLen - (StartOffs/rate))
	RPR_SetEditCurPos2(0, Pos, 0, 0)
	RPR_Main_OnCommand(40757, 0) #split at cursor, no selection change
	RPR_SetMediaItemSelected(item, 0)
	selCount = RPR_CountSelectedMediaItems(0)
	while selCount > 0:
		item = RPR_GetSelectedMediaItem(0,0)
		itemList.append(item)
		Pos = Pos + loopLen
		RPR_SetEditCurPos2(0, Pos, 0, 0)
		RPR_Main_OnCommand(40757, 0) #split at cursor, no selection change
		RPR_SetMediaItemSelected(item, 0)
		selCount = RPR_CountSelectedMediaItems(0)

#---reselect involved items---:
for i in range(len(itemList)):
	RPR_SetMediaItemSelected(itemList[i], 1)

RPR_SetEditCurPos2(0, cursorPos, 0, 0)
RPR_PreventUIRefresh(-1)
RPR_Undo_EndBlock2(0, "Convert take loops to items",-1)
It just splits into individual items for each iteration of the active take. No glue (glue would have printed take FX, killed other takes, reset rate etc... I think I wouldn't want that with this function). You can do multiple items in one go, btw. At the end of the script all involved items are (re)selected. Not sure about that, but it seemed better than leaving the user with no item selection.

EDIT: shit! I didn't test the script against tempo changes. Of course MIDI item fails. Horrible can of worms now open . Not sure if and how that can be accounted for.

Last edited by gofer; 04-10-2014 at 05:23 PM.
gofer is offline   Reply With Quote
Old 04-10-2014, 04:02 PM   #13
witti
Human being with feelings
 
witti's Avatar
 
Join Date: May 2012
Posts: 1,216
Default

Quote:
Originally Posted by gofer View Post
There seems to be a problem with "Set item length to source media length" when the first loop iteration is not complete (if the left item edge is not on the take section loop border). The action crops the item to the partial loop iteration. I don't think that's intended. I didn't try Witti's macro, but think it breaks under this circumstance.
I think so, too. These macros assume that every 'loop' has the same length.
(Didn't think about that, because most of the time i change the length of an item and then i loop it. -using 'loop section of media items'.)
witti is offline   Reply With Quote
Old 04-10-2014, 05:35 PM   #14
Win Conway
Human being with feelings
 
Join Date: Dec 2010
Posts: 3,826
Default

I just have a button for duplicate item and never loop and more, works out fine for me.
__________________
Stop posting huge images, smaller images or thumbnail, it's not rocket science!
Win Conway is offline   Reply With Quote
Old 04-10-2014, 06:34 PM   #15
foxAsteria
Human being with feelings
 
foxAsteria's Avatar
 
Join Date: Dec 2009
Location: Oblivion
Posts: 10,272
Default

Quote:
Originally Posted by Viente View Post
Thanks! I'll try to improve your custom action with EEL script as soon as i figure out new syntax (i was used Python before)
i've been thinking of learning python, is eel better? i only have basic programming knowledge and would like to use it beyond reaper if i'm going to learn...
__________________
foxyyymusic
foxAsteria is online now   Reply With Quote
Old 04-10-2014, 11:21 PM   #16
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Thanks gofer! Your script does exactly what i need!

2 PooFox:
EEL is embeded in REAPER by default, so no need to install anything which means its 100% portable, and it seems its also faster than Python. The syntax is like JS.
Viente is offline   Reply With Quote
Old 04-10-2014, 11:31 PM   #17
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Quote:
Originally Posted by gofer View Post
For some reason I never seem to get undo right ...
Could you please open a bug issue in the tracker? I can't find such a thing here. But its obvious that something wrong with undo in the reascript world...

Quote:
Originally Posted by gofer View Post
EDIT: shit! I didn't test the script against tempo changes. Of course MIDI item fails. Horrible can of worms now open . Not sure if and how that can be accounted for.
Could you please "protect" the script from being run if there any tempo changes on the way? Probably with dialog window telling there are tempo changes detected. Or at least just warning? Thanks!
Viente is offline   Reply With Quote
Old 04-11-2014, 02:58 AM   #18
gofer
-blänk-
 
gofer's Avatar
 
Join Date: Jun 2008
Posts: 11,359
Default

Keep finding more worms: items with stretch markers and MIDI which "ignores project tempo use n bpm instead" break my script as well .

Throw it in the trash bin, there must be a better approach.
gofer is offline   Reply With Quote
Old 04-11-2014, 06:17 AM   #19
Viente
Human being with feelings
 
Viente's Avatar
 
Join Date: Feb 2012
Posts: 1,972
Default

Quote:
Originally Posted by gofer View Post
Throw it in the trash bin, there must be a better approach.
Nah, its still useful for me! Thanks!
Viente is offline   Reply With Quote
Old 06-25-2014, 10:20 PM   #20
ChaosComplete
Human being with feelings
 
Join Date: Nov 2012
Location: Long Island
Posts: 20
Default

I was googling this to see if it existed. I miss this from my days starting out in Logic 8 on a Mac. Would be really cool if this could happen in REAPER.
__________________
Michael J Perrotta
Private Guitar and Bass Instruction | Recording Mixing Performance Composition
www.michaeljperrotta.com
ChaosComplete is offline   Reply With Quote
Old 07-01-2014, 12:29 AM   #21
vanhaze
Human being with feelings
 
vanhaze's Avatar
 
Join Date: Jul 2012
Location: Netherlands
Posts: 5,247
Default

Is this plugin also 64 bit for pc ?
vanhaze is offline   Reply With Quote
Old 02-23-2018, 07:03 AM   #22
rull3
Human being with feelings
 
Join Date: Oct 2017
Posts: 4
Default

Any news on this?

Thanks
rull3 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 11:18 AM.


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