turning files on and off

benree's icon

At the moment if you turn one audio file on and then turn on the other they both play together. Anyone able to tweak attached patch so that;

when you turn one audio file on (which lights green LED) it turns the other audio file off (turning green LED off)?

cheers,

ben

2735.openclosefiles.maxpat
Max Patch
Luke Hall's icon

You can always use [print] to see what the objects you are using are outputting, in this case it is either a 1 or 0. You can then use a combination of [select] and [trigger] to stop the other instance of [splay~] in each case. If you're not familiar with these objects then looking at their uses in the helpfiles should make everything a little bit clearer.

Christopher Dobrian's icon
Max Patch
Copy patch and select New From Clipboard in Max.

Since 1 is on and 0 is off, you can use a "== 0" object to produce the opposite (to turn one thing off when you turn the other on and vice versa). Here's a simple example (on the left). But because a click will occur when you turn a sound off abruptly, you probably want to fade it out before you stop it, and fade the other sound in over the same amount of time, as in the example on the right.