Old 02-16-2015, 01:45 PM   #1
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,029
Default ReaScript: Check for common source sections in audio items selection

Hi !

I am glad to show you what is my most complex script so far! It mostly designed for sound design/sound illustration (ambiances) and music editing, but it can be useful for other kind of projects.

Context
When working on complex sound ambiances, it is not rare that I have a sound file with a lot of repeating sounds (real life example: 10 minutes of breathing with a stroke in a glass full of water, 5 minutes of hitting a couch with a stick, 15 minutes of smashing tomatoes against the floor...).

Ideally, each sounds used in the project must be different to have a more rich and complex ambiance, and to be transparent for the audience.

In practice, we slice our file in the DAW, and we tried to avoid copy pasting but sometimes... this 5 minutes may not be enough, so we slice, copy and paste. But repeated sound may be too close together, or one sound in particular may appear 10 times while the other are only 2 times in the project... It may not be obvious at first sight, but if a spectator hear this repetition, you can guess that it will be the only thing he will focus on, no matter how much there is drama in your scene.

Same thing when doing music editing projects for story illustration. Once again, it starts from editing long audio file (the music sources), adjust them, split them and cut them, adding some sounds to make the transitions from one source to another more transparent (cymbal rises, bass kick etc...), and once again, we can ends with more repeating sections that we thought.


Concept
This script is able to scan selected items, and determine
if they share a common source,
if they have common source sections,
and how long how this overlaps is.
Of course the results is displayed with a lot of useful infos, such as take name, position, track etc...

Demo (may take a while to load):


Comparison are made two by two. It takes the first item in the selection and compare it to all the other. Then it take the second item and compare it to all the other, but not the first one. Etc...

Note that it is the source sections that are compared, no matter what is the playrate and position of the item, or how many stretch markers the item has. This is source comparison based on item source section.

How to determine what is a common section between two items?

Here is several possible cases, for item source section A and item source section B, sharing a common source file.

Code:
// CASE 1 - A BEFORE B
// [_A_]
//   [_B_]
Code:
// CASE 2 - A INSIDE B
//   [_A_]
//  [__B__]
Code:
// CASE 3 - A CONTAINS B
//  [__A__]
//   [_B_]
Code:
// CASE 4 - A AFTER B
//   [_A_]
// [_B_]
Code:
// CASE 5 - A EQUALS B
// [_A_]
// [_B_]
Code:
// CASE 6 - A DIFFERENT THAN B
// [_A_]
//               [_B_]
For each case, we can determine the overlap duration if there is one, the overlaps start in source, and the overlap position in the project.

Only overlaps are displayed in the console.


Dependencies
This script lies heavily on my console debug script. You will have to download it to use it. I think this script is the perfect example to show this console functions power. It really made the whole process far more easier to code, and you can even have a full detailed report by setting the debug variable as 1.

As you can see, this script is the first I wrote that use the unified header template :P


Source Time Position Tool
This script wouldn't have been possible without reverse engineering the brilliant Source Time Position Tool from planetnine. It leads me to find ways to determine length of source sections, and I even use some functions of this script in mine. I strongly advice you to use the Item Source Inspector with my script, or without, it is a great tool! Thanks to its developer for it's great work on this, and for the helpful comments in the source file!


Known Limitations
There is some limitations with this script, because it is already pretty complex, and honestly, it involves cases that I don't personally need for my workflows.

  • Items that loop but don't start to zero are not taken into account. It would need to be treated as two items, and this would multiply the script size by at least 2. I never have looping item that don't start from 0 in source time, so... no.
  • Items are compared two by two. I don't know if there is other ways to do, but this make certain actions very hard, such as determine what common source section is used the most among all common source sections of a same source file. I don't think it would be that useful anyway. Determine how many times a same file is implicated in a common source conflict is pretty hard too. I tried. No success.

Go further
I thought about deeper ways to compare items but once again it started to become overly complicated, such as comparing pitch if the user said he want in a dialog box etc... but personally I only used pitch envelope for shifting (they are more visual), and it would be much harder to compare (comparing envelope points based on source time position sections... urf).

I left raw questions and note at the bottom code at the bottom of the script, don't pay attention to it !


Conclusion
I hope you will find it useful, it was a nasty beast to code, with a lot of intricated conditions and loops.

I am pretty happy with the result anyway !

I am thinking about an alternative with "set a source for comparison" button, inspired by the copy paste item parameters script by spk77 (the great). It will allow to compare one item to a selection.

So, what do you think of that ?

Note: my version doesn't work with pre v5 because of the TakeIsMidi function, but I'm pretty sure there is a way to make a fork for v4 if needed. That's why I share it now

Download Link =====>
Check my signature, download my collection and look for Various subfolder

EDIT (06/04/2015):
A new script based on this (and maybe more useful) for REAPER v5, which is able to compare item under mouse against item selection !
  • X-Raym_Check for common source sections between item under mouse and audio items selection.eel

Demo


Last edited by X-Raym; 04-05-2015 at 03:18 PM.
X-Raym is offline   Reply With Quote
Old 03-10-2015, 03:26 AM   #2
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,404
Default

another idea for this one too. Color all items that share the same source file. Based on the color of the selected one. or to choose a color somehow
heda is offline   Reply With Quote
Old 03-10-2015, 04:23 AM   #3
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,029
Default

And what about a combination of coloring item and coloring item part with Empty Item Overlay ?

(this is a very bad screenshot because the two parts are not the same ^^)


This script drove me crazy once. I will have to take a deep breath before getting into it again :P

Note: all theme will not be able to do proper item overlay, but it is still a good solution, without touching the original files (it is one key element of this script).
And this could lead to script to delete all item created by this one.
X-Raym is offline   Reply With Quote
Old 03-10-2015, 10:47 AM   #4
heda
Human being with feelings
 
heda's Avatar
 
Join Date: Jun 2012
Location: Spain
Posts: 5,404
Default

I don't understand. ¿?
empty item overlay? what purpose?

maybe it is better to create a new script that only does this: Select one take and run the script to color all takes in the project that share the same source file with the selected take color.
heda is offline   Reply With Quote
Old 03-10-2015, 11:20 AM   #5
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,029
Default

To highlight item sections without cut them out from the original items, of course!
I have to admit it is not very conventional.
And I will probably NOT do it. But I think there is an idea!

Your idea is in my idea.txt box since I found the spk77 copy paste item properties script
I did made an attempt, but it was not successful so far. It is in my beta folder.
So I get back to more funnier stuff!
X-Raym is offline   Reply With Quote
Old 04-05-2015, 03:20 PM   #6
X-Raym
Human being with feelings
 
X-Raym's Avatar
 
Join Date: Apr 2013
Location: France
Posts: 6,029
Default Check for common source sections between item under mouse and items selection

New script based on this one:
  • X-Raym_Check for common source sections between item under mouse and audio items selection.eel
Screenshot in first post !


X-Raym 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 04:50 PM.


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