Old 03-06-2010, 02:43 PM   #1
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default Is it possible...

...to access the "default fade length" set in the preferences through ReaScript or something? I really just want to create 2 actions, "set default fade length to 0ms" and "set default fade length to 5ms". If anyone knows of a way to do this I would be ecstatic!

What would be better even, would be an action that was "Toggle default fade length on/off", so that when set to off, default fades were 0ms, and when it was on, the default fade length would be whatever is set in the preferences. This would be AMAZING for me, pleaaaase!

EDIT: Video explanation...

http://www.adamwathan.com/reaper/def...xplanation.mov

Last edited by AdamWathan; 03-07-2010 at 08:26 AM.
AdamWathan is offline   Reply With Quote
Old 03-06-2010, 03:24 PM   #2
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

Think that's all available in the SWS extension.

You have the option to have actions for different fade presets
musicbynumbers is offline   Reply With Quote
Old 03-06-2010, 03:39 PM   #3
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

Nah not for what I want. I keep my fades at 0 pretty much all the time, but I'd like to create 2 separate split actions, one that doesn't create a crossfade and one that does create 5ms crossfade. The macros to accomplish this now are long winded and cause a lot of crashing and instability for me on the OS X version. Since I can always leave "autocrossfade at split" turned on, a simple action to change the fade length would shorten everything, as my split action could just be:

"set default fades to 5ms"
"split item"
"set default fades to 0ms"

...instead of the long and unstable actions I'm using now :/
AdamWathan is offline   Reply With Quote
Old 03-06-2010, 04:46 PM   #4
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

I'm not sure why you can't just use the actions for disabling and enabling auto crossfade on split before and after the split command?

surely a 0 crossfade is the same as no crossfade at all?

what am I missing here?
musicbynumbers is offline   Reply With Quote
Old 03-06-2010, 05:02 PM   #5
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

I don't want my items to have any fade ins or fade outs automatically ever. So I want my fade length to be zero ALL THE TIME, unless I am splitting something. The only way to do that is to be able to toggle the default fade length. If I have my fade length set to 5ms and toggle the crossfades at split, all my items will have 5ms fade ins and fade outs :/ so I don't want any default fades at all, but I do want to have an action that splits and adds a crossfade, and I want to do it using the native "autocrossfade at split" behavior to avoid crashes and instability, so the only way to do it is to find a way to toggle the default fades between two values :/
AdamWathan is offline   Reply With Quote
Old 03-06-2010, 06:02 PM   #6
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

I'm missing your point here surely?

If you make two custom actions one that;

-disables auto crossfade on split
-split at mouse cursor/edit cursor

then that creates no crossfades, then create a second

-enable crossfade on split
-split at mouse cursor/edit cursor

and set your crossfade to 5ms in prefs that does it right?

I don't use crossfades like this much anyway so I might be missing your point
musicbynumbers is offline   Reply With Quote
Old 03-06-2010, 06:06 PM   #7
KevinW
Human being with feelings
 
KevinW's Avatar
 
Join Date: Sep 2009
Location: Dayton, Ohio USA
Posts: 1,714
Default

Just a suggestion here, but I think it would work if you try this:
Leave your default fade at 0ms. Write a reascript that uses the SetMediaItemInfo_Value to set the fade length to whatever value you want, and incorporate a Main_OnCommand that invokes that "split item..." action. (You can call the split function in the reascript, too, but that just seems harder.)

Then map that script to the key that you currently use with just the "split" action ("S" is the default, I think.)

My standard disclaimer applies. I'm no programmer, so there is probably an easier/more efficient/better way. (EDIT - MBN proves my disclaimer!)
KevinW is offline   Reply With Quote
Old 03-06-2010, 06:33 PM   #8
EvilDragon
Human being with feelings
 
EvilDragon's Avatar
 
Join Date: Jun 2009
Location: Croatia
Posts: 24,798
Default

Quote:
Originally Posted by musicbynumbers View Post
If you make two custom actions one that;

-disables auto crossfade on split
-split at mouse cursor/edit cursor

then that creates no crossfades, then create a second

-enable crossfade on split
-split at mouse cursor/edit cursor

and set your crossfade to 5ms in prefs that does it right?
This should do it. It's not long-winded at all. No need for ReaScript.
EvilDragon is offline   Reply With Quote
Old 03-06-2010, 06:59 PM   #9
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

I hope your right Evil Dragon I'm starting to think I've gone mad or turned "internet invisible".
musicbynumbers is offline   Reply With Quote
Old 03-06-2010, 07:05 PM   #10
KevinW
Human being with feelings
 
KevinW's Avatar
 
Join Date: Sep 2009
Location: Dayton, Ohio USA
Posts: 1,714
Default

Quote:
Originally Posted by musicbynumbers View Post
I hope your right Evil Dragon I'm starting to think I've gone mad or turned "internet invisible".
Not invisible. I think we both posted solutions simultaneously, and yours was much simpler (see my edit )
KevinW is offline   Reply With Quote
Old 03-06-2010, 08:07 PM   #11
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

No sorry you guys are missing the point entirely :/

I don't want any fade ins or fade outs on my items by default, so the default fade length needs to be zero. If the default fade length is zero, then splitting an item with "crossfade on split" enabled creates a zero ms crossfade aka no crossfade. I need it to create a 5ms crossfade. Currently, the only actions that successfully create a 5ms crossfade while having the default fade length set to 0ms are long winded and result in some instability, at least on the systems I have tried.

I don't need to ever disable "crossfade on split." It should be enabled at all times. I just need the fade length to change to 5ms when I split so that a crossfade is actually created. Again, if I have the default fade length set to 5ms, then all my items will have 5ms fade in/outs, which I do not want under any circumstances. So again, the default fade length needs to be 0ms for every single scenario in my workflow EXCEPT for splitting items, but even then, I want separate actions for "split and create crossfade" and "split with no crossfade." The only way to do this in an efficient and stable manner (based on my findings) is to be able to have an action that changes the default fade length so it can be a different value for each of the two actions. Again, this has nothing to do with enabling or disabling crossfades on splits. If my default fade length is 5ms and I make a split without a crossfade, Ill get a 10ms dip in volume since the first item will fade out and the second will fade in (the reason I hate default fade in/outs.) If my default fade length is 0, crossfade on split can be enabled or disabled and the split will still look exactly the same. Hence why I want to leave "crossfade on split" always enabled, but toggle the fade length between 0 and 5ms instead. The current macros to create a split and 5ms crossfade involve creating like 3 time selections, changing the item selection several times and moving the edit cursor back and forth all over the place. The action is complicated and if you consolidate undo points and try to undo several splits in a row that were created by that action, Reaper will crash every time without fail (see my thread in bug reports section.)

Hopefully I've explained this better this time! If not I will make a video next time I'm at my computer to explain it in more detail, I'm currently posting this from my iPhone at a stag and doe (huge party pooper alert! Haha) thanks for the help guys! I turned to this forum because it seems like programming my own extension that adds an action to change the fade length is the only way to accomplish this. If the devs could add a native action called "Toggle default item fades" this would all be solved! That way you could choose to disable automatic item fades (ie set the default fade length to zero) or enable them (restore default fade length to value set in prefs.) Very important though, it must not just change every fade to zero when you disable it or change them all to the user value when enabled, it should only affect items created/split/whatever from the point of toggle, so all the fades you defined previously stay the way you set them of course!
AdamWathan is offline   Reply With Quote
Old 03-06-2010, 08:55 PM   #12
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

"If my default fade length is 5ms and I make a split without a crossfade, Ill get a 10ms dip in volume since the first item will fade out and the second will fade in (the reason I hate default fade in/outs.)"

I'm sure there is a what round this with the sws extension, if I get time i'll look into it

I'm not sure why you don't just set default fades to zero though and use the sws actions to set certain fade ins and outs on all the items you want this to happen on, this way splitting does not cause any fades at all.

There will be a way
musicbynumbers is offline   Reply With Quote
Old 03-06-2010, 09:06 PM   #13
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

If you split with no crossfades and fade length set to zero and then change the fades afterwards using the SWS fade configurations, it won't cause them to overlap creating a crossfade, just add the annoying dips instead. Trust me I've been trying to do this for weeks and this is the best solution (if I can actually create the action to toggle the default fades of course). I want the crossfade to be created with the split, not added afterwards manually :/

I just want to make use of Reaper's native crossfade at split behaviour, but without having to change the fade length manually. Currently, I have to have default fades set to zero and then any time I want to do some slip editing or something where I need splits with crossfades, I hav to manualy set the default fade length to 5ms in the prefs, then do my editing, and then when I'm done, set the default fades back to zero. I just want a way to toggle it without going into the prefs to change it manually every time.
AdamWathan is offline   Reply With Quote
Old 03-06-2010, 09:42 PM   #14
KevinW
Human being with feelings
 
KevinW's Avatar
 
Join Date: Sep 2009
Location: Dayton, Ohio USA
Posts: 1,714
Default

Well, I sure don't know how to toggle the default fade length, and it does seem like that would be a compromise you're willing to live with. But I do think that a reascript that includes the commands:

RPR_SetMediaItemInfo_Value(itemaftersplit, "D_FADEINLEN_AUTO", 5)
RPR_SetMediaItemInfo_Value(itembeforesplit, "D_FADEOUTLEN_AUTO", 5)

could be part of a solution. The logic, it would seem, would be to
1. split the item
2. select the item after the split
3. set the fadeinlen_auto to 5
4. select the item before the split
5. set the fadeoutlen_to 5

By default, the item after the split is selected when you make a split. The part I'm not sure how to do would be to select the item before the split from inside the reascript.
If you could figure this out, then you wouldn't have to worry about changing the default fade length.

As an alternative, you could create two separate one line scripts, one to set the fade in and one to set the fade out, and assign them to convenient keys, say "A" and "D". Then your workflow might be something like

press S (to split)
select the pre-split item, press A (set fade out)
select the post-split item, press D (set fade in)

So you would still have to make a couple of item selections (hopefully fewer than you currently make?), but I don't see why you would need any time selections. You could avoid mouse clicks by using the "select item under mouse cursor" command, but now we're just splitting hairs.

I'm afraid that's about all I know on the subject, but if I think of anything else I'll let you know.
KevinW is offline   Reply With Quote
Old 03-06-2010, 10:16 PM   #15
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

Hey thanks for trying, that will just create a fade out, then a fade in on the next item though, no crossfade since they don't overlap :/ Current action is huge and buggy...



Works (although unstable and buggy, especially when undoing) but would be so much easier to just use the native ability to split with a crossfade, just a matter of toggling the fade length somehow :/
AdamWathan is offline   Reply With Quote
Old 03-07-2010, 04:34 AM   #16
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

Edit ............................Due to stupid question

This code removes the fadein fadeout of all selected items.

Code:
# Get number of items currently selected
$Item_Count = RPR_CountSelectedMediaItems(0);
$Item_Index = 0;

# Update fades for each selected item
while ($Item_Index < $Item_Count) {
	# Get ID for current item index
	$Item_ID = RPR_GetSelectedMediaItem(0, $Item_Index);

	

	# Set new fadein fadeout value for current item
	RPR_SetMediaItemInfo_Value($Item_ID, "D_FADEINLEN", 0);
        RPR_SetMediaItemInfo_Value($Item_ID, "D_FADEOUTLEN", 0);

	# Redraw item to update volume envelope
	RPR_UpdateItemInProject($Item_ID);

	$Item_Index++;
}
From this you can easily archive what KevinK serjested or import your files and remove the fades using this code

Thnx to SFGeek for the backbone of this code

S
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090

Last edited by jedstar2000; 03-07-2010 at 05:04 AM.
jedstar2000 is offline   Reply With Quote
Old 03-07-2010, 05:48 AM   #17
KevinW
Human being with feelings
 
KevinW's Avatar
 
Join Date: Sep 2009
Location: Dayton, Ohio USA
Posts: 1,714
Default

Wouldn't this code remove both the fade in and fade out from all selected items? If so, I think it's not quite the OP's goal, as I believe he wants to keep the fadeout/in at the crossfades, but not anywhere else.

Quote:
Originally Posted by AdamWathan View Post
Hey thanks for trying, that will just create a fade out, then a fade in on the next item though, no crossfade since they don't overlap :/ Current action is huge and buggy...
I'm pretty sure this code will work for you:

Quote:
#to use this script


# first (prior to executing the script), split the item
# then select the first half of the split
# run the first part of the script, which lengthens the item by the
# specified time in the variable "fadetme"

it = RPR_GetSelectedMediaItem(0,0)
length1=RPR_GetMediaItemInfo_Value(it, "D_LENGTH")

fadetime = .05
newlength = length1 + fadetime;
RPR_SetMediaItemInfo_Value(it, "D_LENGTH", newlength)
RPR_SetMediaItemInfo_Value(it, "D_FADEOUTLEN_AUTO", fadetime)
RPR_UpdateTimeline()


#now, in a separate script, put the following code
# which will create a fade in of the second half of the split item

#to use, just select the second half of the split item

it = RPR_GetSelectedMediaItem(0,0)

fadetime = .05
RPR_SetMediaItemInfo_Value(it, "D_FADEINLEN_AUTO", fadetime)
RPR_UpdateTimeline()
KevinW is offline   Reply With Quote
Old 03-07-2010, 06:05 AM   #18
KevinW
Human being with feelings
 
KevinW's Avatar
 
Join Date: Sep 2009
Location: Dayton, Ohio USA
Posts: 1,714
Default

EDIT,
Actually, since the default for a split is to leave the second half already selected, you could eliminate one step.

Make a macro that
a. splits the item
b. calls the 2nd part of the script above

Then, use your favorite method to select the first half of the split item, and call the 1st part of the script above, which lenghtens the item and sets the desired fade out.

I could still be missing what you're after. One downside I do see is that the fade is not centered on the split, but is 1/2 of the fade length after where you defined the split. There might be a way to fix that if it's a big deal to you, but I'm not sure.
KevinW is offline   Reply With Quote
Old 03-07-2010, 06:44 AM   #19
KevinW
Human being with feelings
 
KevinW's Avatar
 
Join Date: Sep 2009
Location: Dayton, Ohio USA
Posts: 1,714
Default

And I just noticed that my sample code specifies 50 ms, not 5 ms, but you get the jist.

Last, you could take care of the offset split position by using D_POSITION parameter on the 2nd item, and making it so the first item is lengthened by 1/2 the desired cross fade time, and the 2nd item is made to start earlier by the same amount.

I should have mentioned that the script above is for Python.
KevinW is offline   Reply With Quote
Old 03-07-2010, 08:32 AM   #20
AdamWathan
Human being with feelings
 
AdamWathan's Avatar
 
Join Date: Apr 2008
Location: Cambridge, Ontario
Posts: 2,644
Default

Here's a quick video explaining in more detail what I'm trying to do...
http://www.adamwathan.com/reaper/def...xplanation.mov

I already have custom macros that will accomplish what I want, but like I said they are longwinded, slow and cause instability when undoing them, so I'd like to use Reaper's native built in "crossfade on split" functionality to create my crossfades when I split.

All I want to do is take the process of me opening the preferences window, changing the default fade time from 0 to 5, then splitting, then going back to preferences window and changing the default fade time from 5 back to 0 and automate all of that into a single process. The easiest way to do that is to toggle "default item fades" ON or OFF, where ON would be the value in the preferences, and OFF would automatically behave as if that value is 0.

If the default fade length is not currently a parameter that is accessible via ReaScript or anything then I guess I am SOL. Like I said, there are other ways to accomplish what I am trying to do and I have tried them all, but none of them are very quick and all of them are unstable, in both OSX and Windows.
AdamWathan is offline   Reply With Quote
Old 03-07-2010, 09:49 AM   #21
jedstar2000
Human being with feelings
 
jedstar2000's Avatar
 
Join Date: Apr 2009
Location: Bristol uk
Posts: 1,006
Default

The two codes above give you the solutions.

KevinW's code should do exactly what your after (although I haven't tested it) and the code I've put up gives you an action to add to your paste action to remove fadein fadeout times
__________________
...............Reaper the DIY DAW.....................
MultiTrack Editing Macros http://forum.cockos.com/showthread.php?t=50111
Hybrid Theme http://forum.cockos.com/showthread.php?t=131090
jedstar2000 is offline   Reply With Quote
Old 03-07-2010, 11:52 AM   #22
musicbynumbers
Human being with feelings
 
musicbynumbers's Avatar
 
Join Date: Jun 2009
Location: South, UK
Posts: 14,218
Default

Ok watched the video I must of missed the slip edit bit because it makes sense now

firsly I would ask tim from sws for a action to turn off autofades for the start an ends of items (or better yet get the devs to add it

secondly the paste without fades is easy.

Create a custom action

-paste
-sws: set fades of selected items to 0.0

that should work since pasted items are normally still selected.

I might need to watch your vid again when I have time but I have this underlying feeling that your going too far down one certain route and missing a much easier way to do it will try and get back to you on that though, I really think you should start a feature request though as having an option to have the default fade in out times permanently set but just be able to turn them on and off (like auto crossfades) would be great for a lot of people.
musicbynumbers 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 08:36 AM.


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