So I built this today, first real script I've ever created so go easy on me
It is not bullet proof and will give some unexpected results if you try and use it in the wrong situation, but as long as you use some common sense and only invoke it when you are trying to get it to do what it is supposed to do it works pretty flawlessy!
Change "fadeLength = 0.008" to whatever value you want your default crossfades to be. 8ms seems to work pretty well for me for just smoothing out splits after doing some vocal time stretching edits for example.
Here's the Python script:
Code:
fadeLength = 0.008;
itemCount = RPR_CountSelectedMediaItems(0);
if itemCount > 1:
itemID = RPR_GetSelectedMediaItem(0, 0);
takeCount = RPR_CountTakes(itemID);
takeIndex = 0;
while takeIndex < takeCount:
currentTake = RPR_GetMediaItemTake(itemID, takeIndex);
itemLength = RPR_GetMediaItemInfo_Value(itemID,"D_LENGTH");
newLength = itemLength + (0.5 * fadeLength);
RPR_SetMediaItemInfo_Value(itemID, "D_LENGTH", newLength);
RPR_SetMediaItemInfo_Value(itemID, "D_FADEOUTLEN", fadeLength);
takeIndex = takeIndex + 1;
if itemCount > 2:
itemIndex = 1;
while itemIndex < (itemCount-1):
itemID = RPR_GetSelectedMediaItem(0, itemIndex);
takeCount = RPR_CountTakes(itemID);
takeIndex = 0;
while takeIndex < takeCount:
currentTake = RPR_GetMediaItemTake(itemID, takeIndex);
itemLength = RPR_GetMediaItemInfo_Value(itemID,"D_LENGTH");
itemPosition = RPR_GetMediaItemInfo_Value(itemID,"D_POSITION");
startOffset = RPR_GetMediaItemTakeInfo_Value(currentTake, "D_STARTOFFS");
newLength = itemLength + fadeLength;
newPosition = itemPosition - (0.5 * fadeLength);
newOffset = startOffset - (0.5 * fadeLength);
RPR_SetMediaItemInfo_Value(itemID, "D_LENGTH", newLength);
RPR_SetMediaItemInfo_Value(itemID, "D_POSITION", newPosition);
RPR_SetMediaItemInfo_Value(itemID, "D_FADEINLEN", fadeLength);
RPR_SetMediaItemInfo_Value(itemID, "D_FADEOUTLEN", fadeLength);
RPR_SetMediaItemTakeInfo_Value(currentTake, "D_STARTOFFS", newOffset);
takeIndex = takeIndex + 1;
itemIndex = itemIndex + 1;
itemID = RPR_GetSelectedMediaItem(0, (itemCount - 1));
takeCount = RPR_CountTakes(itemID);
takeIndex = 0;
while takeIndex < takeCount:
currentTake = RPR_GetMediaItemTake(itemID, takeIndex);
itemLength = RPR_GetMediaItemInfo_Value(itemID,"D_LENGTH");
itemPosition = RPR_GetMediaItemInfo_Value(itemID,"D_POSITION");
startOffset = RPR_GetMediaItemTakeInfo_Value(currentTake, "D_STARTOFFS");
newLength = itemLength + (0.5 * fadeLength);
newPosition = itemPosition - (0.5 * fadeLength);
newOffset = startOffset - (0.5 * fadeLength);
RPR_SetMediaItemInfo_Value(itemID, "D_POSITION", newPosition);
RPR_SetMediaItemInfo_Value(itemID, "D_LENGTH", newLength);
RPR_SetMediaItemInfo_Value(itemID, "D_FADEINLEN", fadeLength);
RPR_SetMediaItemTakeInfo_Value(currentTake, "D_STARTOFFS", newOffset);
takeIndex = takeIndex + 1;
RPR_UpdateItemInProject(itemID);
So to reiterate, this script is meant to take a bunch of splits in an item and put a crossfade at each split. It won't work if the items are already overlapping or if there is a gap between the items, so don't try and use it there because it's not meant to do anything in a situation like that. You wouldn't throw your car in reverse while going forward at 100mph on the freeway right? Same deal here
This is superior to any macros I could come up with because it doesn't alter anything on the left and right sides of the selection, so if the first item and last item have a fade in/out already, they aren't altered at all, it only affects things on the inside of the selection.
Before running script:
After running script (notice the first fade in and pre-existing crossfade at the end of the selection survive unscathed):