Go Back   Cockos Incorporated Forums > REAPER Forums > Recording Technologies and Techniques

Reply
 
Thread Tools Display Modes
Old 05-06-2020, 11:44 PM   #1
Colox
Human being with feelings
 
Join Date: Feb 2012
Location: Sweden
Posts: 1,206
Default Advanced track selection enigma. I'm stuck, could use help

I'm struggling to create an action or process which selects certain tracks within a specified amount of tracks only. Hoping for some help or suggestions.

I use the SWS console, to search for- and select tracks (for this task). I’m using the track label as the search criterium. Entering “s *.bus” in the Reaconsole will select all tracks in the project with “.bus” in the end of its name. This works, because I use a super-strict track labelling routine.

But now I need this same procedure to work differently. I need this process to search for matching track criterias only inside a certain group of files - as opposed to searching all tracks in the project. Note, when I say “group” I do not mean group as in Reaper’s track grouping option. I just say ‘group’ as in meaning a selection of tracks, as opposed to “all” tracks.

I’m having problems seeing clear ways to make this work. I can follow advanced reasoning just fine, but my problem is I'm not technically fluent enough in the many possible procedures in Reaper, to deduct - off of the top of my head - which ways are possible or the most suitable. Heck, maybe a python script would be the better option here.

I have concluded that I may be able to get somewhere using a multiple level search, like for example first search for parent tracks containing a certain label condition, and then continue searching within that parents’ child tracks. But it’s real tricky, and I feel like I’m possibly painting myself into a corner by using that method.

Frankly I’m not even sure that my initial choice of method is the most relevant one. Maybe I'm already painted into a corner. I can tell you of my top-level overall scenario if that helps.

I’m hoping for some suggestions or tips to get loose from this quicksand I’m stuck in.

Thanx for any input
/C.
__________________
There are only two kinds of people in the world: those who entertain, and those who are absurd.
- Britney Spears
Colox is offline   Reply With Quote
Old 05-07-2020, 04:10 AM   #2
valy
Human being with feelings
 
Join Date: Jan 2020
Posts: 1,927
Default

Sounds like you will need a script to do what you want.

The critical thing to know is: What are the criteria for determining the tracks to be searched? What makes them discernable from the other tracks in the project?
valy is offline   Reply With Quote
Old 05-07-2020, 05:32 AM   #3
Colox
Human being with feelings
 
Join Date: Feb 2012
Location: Sweden
Posts: 1,206
Default

Quote:
Originally Posted by valy View Post
Sounds like you will need a script to do what you want.
I guess it does, doesn’t it? I’m glad someone told me I’m not as nuts as I feared.
Quote:
Originally Posted by valy View Post
The critical thing to know is: What are the criteria for determining the tracks to be searched? What makes them discernable from the other tracks in the project?
At this time, I use track labels to find what I want to find. Since track numbers change when you add or remove tracks, and parent/child landscapes change too, it seems the track label are the only ‘tags’ left – or at least the best one I can see.

I guess one could make a JS effect, with no code in it, and put it on all tracks and then rename the effect instance differently on each individual track. That JSFX effect name might create a different ‘tag’ type than track labels. But I mean …. come on?!
Maybe one could use SWS track notes to write tags for every track. But I don’t know what search function would scan track notes. Either way, track labels it is – until something better reveals itself.I guess that's why I am experiencing this problem in the first place.

The tracks I want to find, with this ‘search just in a group of tracks’ function, all have the designation *.DI at the end of their label. For example: brs.ac.trp1.DI, or key.ac.pno.DI etc. I call them “direct tracks”. Other aspects that all direct tracks share, are:
- They are all child tracks (all located under different "[instrument name].bus" parent tracks)
- They are all initially hidden tracks
- None of them utilize any sends
- All of them have "send to parent" set to off
- None of them have any items on them
- None of them have any effects on them

There are are other tracks which may fit the above conditions, but only direct tracks are named *.DI in their label.

And the "groups" I wish to limit each search to, are the instrument buses. These buses are top level parent tracks which houses individual instrument track configurations (as child tracks) under them. The instrument buses are labelled like "drums.bus", "bass.bus" etc. There are 15 of them.
__________________
There are only two kinds of people in the world: those who entertain, and those who are absurd.
- Britney Spears

Last edited by Colox; 05-07-2020 at 07:02 AM.
Colox is offline   Reply With Quote
Old 05-07-2020, 05:21 PM   #4
valy
Human being with feelings
 
Join Date: Jan 2020
Posts: 1,927
Default

OK. It's doable, but it will take someone with better Lua skills than me.


Here is a script I found that searches for tracks by name:

https://gist.github.com/jtackaberry/...93709360ffe5b5

That one searches by label prefix rather than suffix, however.


Thinking in pseudocode, it seems this would work:

---------------------------------------------------------------------------------

search for the first track with ".DI" as the last three characters of its name

check if its parent track has ".bus" as the last three characters of its name

if yes, scroll the .DI track into focus
else search for the next .DI track

---------------------------------------------------------------------------------

I think you could search for the desired suffixes using the strfind() function. It would just be a matter of iterating through all the tracks in your project to find the right ones.

I'm not sure if it would be more efficient to search for the child tracks and check their parents, or search for the parent tracks and check their children. I guess that would depend on the ratio of relevant children to parents and how many relevant parents have zero relevant children.

If you wanted to find all tracks that meet the criteria and display them all at once while simultaneously hiding the others, you could probably do that too by finding each qualifying .DI track and storing its track ID in an array. Then once the search is done, you could display all the tracks with array IDs and hide the rest.
valy is offline   Reply With Quote
Old 05-07-2020, 05:53 PM   #5
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Here you go: https://gist.github.com/cfillion/5bc...3798ca8afd9211.

This script supports searching through any level of folders. To select tracks ending by .DI inside of tracks ending by .bus:

Code:
local NESTED_RULES = {
  ['%.bus$'] = {
    '%.DI$',
  },
}
EDIT (0.2beta): Set RECURSIVE = true if the .bus folder tracks are not always at the top-level.

Last edited by cfillion; 05-07-2020 at 06:21 PM.
cfillion is offline   Reply With Quote
Old 05-10-2020, 03:08 PM   #6
Colox
Human being with feelings
 
Join Date: Feb 2012
Location: Sweden
Posts: 1,206
Default

Quote:
Originally Posted by cfillion View Post
Here you go: https://gist.github.com/cfillion/5bc...3798ca8afd9211.

This script supports searching through any level of folders. To select tracks ending by .DI inside of tracks ending by .bus:

Code:
local NESTED_RULES = {
  ['%.bus$'] = {
    '%.DI$',
  },
 }
EDIT (0.2beta): Set RECURSIVE = true if the .bus folder tracks are not always at the top-level.
Ohh, thank you so much for showing me this, and for your work!

I'm having moderate success in implementing your script. It is working overall as thought, although there seems to be a confusion when using parent/child track structures under the instrument.bus level.

I am learning lua myself right now, and I will try to use this to try and utilize it in different ways. One thing I'd like to ask about, is how you figure out interfacing factors between the script and Reaper. Like this one for example: "reaper.PreventUIRefresh". That's not a part of the lua terminology, nor is it a Reaper action. So it could be part of the Reaper application(?) I imagine there could be a list of those, like a library for scripters to use, to collect things from Reaper and send things into Reaper?
__________________
There are only two kinds of people in the world: those who entertain, and those who are absurd.
- Britney Spears
Colox is offline   Reply With Quote
Old 05-10-2020, 08:04 PM   #7
cfillion
Human being with feelings
 
cfillion's Avatar
 
Join Date: May 2015
Location: Québec, Canada
Posts: 4,937
Default

Quote:
Originally Posted by Colox View Post
although there seems to be a confusion when using parent/child track structures under the instrument.bus level.
Can you share an example of a track structure like that and what the issue is? Depending on what it is, it might be fixable...

Quote:
Originally Posted by Colox View Post
Like this one for example: "reaper.PreventUIRefresh". That's not a part of the lua terminology, nor is it a Reaper action.
It's one of REAPER's many API functions that are made available to ReaScripts by REAPER and extensions.

You can access the current list of them customized for your install via Help > ReaScript documentation.
cfillion is offline   Reply With Quote
Old 05-11-2020, 01:55 AM   #8
Colox
Human being with feelings
 
Join Date: Feb 2012
Location: Sweden
Posts: 1,206
Default

Quote:
Originally Posted by cfillion View Post
It's one of REAPER's many API functions that are made available to ReaScripts by REAPER and extensions.
You can access the current list of them customized for your install via Help > ReaScript documentation.
Goldmine! Sorry but this was a minor heureka moment for my (so far) lame abilities. Superthanks.

Quote:
Originally Posted by cfillion View Post
Can you share an example of a track structure like that and what the issue is? Depending on what it is, it might be fixable...
Like I said, I’m learning lua, but my level of terminology and of programming in general is bordering the level you’ve used to write this script. So I can follow what you wrote, but my repertoire doesn’t extend to immediately suggest workable changes. Not yet. I thought it would be by now, but oh no, some ppl just have to be so clever with their scripts!

Just to get the mind into the mindset again: as mentioned, I got instrument.bus tracks with a whole track structure underneath them. And I wish for the search function to search through only the child structure of a given “instrument.bus”.

The problem I seem to encounter, is the script seems to search sub-levels tracks - just as intended - but only as long as the sublevel tracks are not child tracks themselves. However, if I got a parent/child structure within- or 'under' an instrument.bus track, then the child tracks of that sub-structure doesn’t seem to get searched. Perhaps the script only searches tracks who are 1 level below a given parent track (instrument.bus), but not tracks 2- or more levels below the instrument.bus track?
In fact, if there is a parent/child structure in under an instrument.bus, the child tracks of that sub-structure doesn't seem to get searched, but also the tracks below the first parent/child structure - tracks that are hierarchically 1 level under the instrument.bus - doesn't seem to get searched.

As I’m trying to follow your script, this seems to be the case with the bolded line:
Code:
if type(ruleKey) == 'string' and trackDepthChange == 1 ...
I managed to sort of get around this, by setting the exact name of the parent tracks that I wish for the script to search under. Instead of just using *.bus$.
Code:
local NESTED_RULES = {
  ['LEAD Voice track.bus$'] = {
  ['Vox.led.main1.supp1.bus$'] = {  
    '%.di$', 
  }, 
  ['Vox.Led.Bi1.bus$'] = {  
     '%.di$',
     },
  ['Name of next parent track under the main instrument.bus$'] = {  
     '%.di$',
     },
This would work, if it wasn’t for the fact that the track structure under each instrument.bus does change a bit with each project. Yes, it is a work template, and the initial starting point in the template is always the same. But depending on what configuration of tracks or instrument I get going, the structure underneath the instrument.bus may (or may not) change somewhat, including the track hierarchy. Such changes include the introduction of plenty of sub parent/child structures under each instrument.bus track.

For the above solution to work I would have to manually write in the name of each sub parent/child structure for the script to search through it, and take it out of that track structure is removed from the present project etc.

Therefore, it needs to be able to automatically and systematically ‘scan’ through each track - below a given and top-level “bus”-track - to find all *.di labelled tracks under there. Regardless of the track hierarchy. The only backstop is the instrument.bus top-level parent track.

As a sidenote: an instrument.bus track in my setup will always be top level track. That will never change. I’ve been elaborating the living Jesus out of this setup I’m using, so no, it will never change. So the rather clever recursive -1 level function won't be necessary, for the use you included it as.

And I really wished it was possible to 'tag' tracks with a different value (even multiple values) than only its label or track number. Wink Justin.
__________________
There are only two kinds of people in the world: those who entertain, and those who are absurd.
- Britney Spears

Last edited by Colox; 05-11-2020 at 02:46 AM.
Colox 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 06:52 AM.


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