mute/unmute track by name

John Clark's icon

Hi!

i'm new in the M4L world and I'd Like to mute/unmute some tracks each time I'm opening a song.

I basically know how to mute track with a specific id but I want to be able to target a track by its name. This way, I could change track order without having to modify my patch.

I found how to get the name of a track. I guess I'll have to make a list with all the tracks of my project to store their ids and names and then scan the list to target the tracks I want to mute. But I have no clue how to manipulate strings within M4L nor making some iterative action like "for(i=0;i<tab.length;i++)"

Here is my patch right now.

Any link which explains the basic programmation concepts (setting variables, iterative actions, conditions, string manipulation etc...) applied to the M4L world would be greatly appreciated.

Thank you

Max Patch
Copy patch and select New From Clipboard in Max.

Source Audio's icon

it is easy to build a list with track names &IDs,

it is more of a question where do you want to enter names

that need to get muted.

How do you store this names into live set etc etc

John Clark's icon

actually I don't need to enter names somewhere, they can be "hard coded" inside the patch, it doesn't need to be dynamic or filled on the fly. My main goal is to automatize some kind of song initialization routines at the loading of one song to be sure the rights tracks are muted/unmuted depending of some "global settings". the main purpose of this is to use backing tracks for live shows.

Therefore, to me the main point is to be able to select tracks which name start with the same prefix (defined in the patch) in a list of all tracks. That's why I need to learn how to manipulate list and strings of character and how to do some iterative actions.

Any advise, example, external links are welcome.

11OLSEN's icon

You can btw change the track order after mapping to a track. That's the 2 outputs of live.path (follow id or object). Anyways, here is an example which might be a starting point

Max Patch
Copy patch and select New From Clipboard in Max.