Switch optimisation

Guilherme Viana's icon

Hi! Fairly new to Max. Basically, I'm developing an interactive installation that, using an API, reads a person's expressions. I receive floats (0.0–1.0) and will use a threshold (> 0.5) to switch between different parameter sets for a synth. I'm trying to achieve the following:

  • Each expression (Neutral, Happy, etc.) must load with preset values that sync to a TouchOSC interface.

  • Manual Override: Moving a slider on TouchOSC should immediately update the active sound parameters.

I'm currently using a Switch object fed by multiple Pak objects. I struggled with getting the Switch to update immediately. It works as intended, but I think there is a much simpler way to do this. Thanks in advance!

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

Source Audio's icon

instead of using pak objects alone you can use for example coll

or pattr based storage to store / recall that parameters.

you could also simplify detection of expression.

if highest value in the list >= 0.5 recall it, otherwise send 0.

P.S. why do you insert slider, limited to 0 ~ 127 integer output,

but use higher ranged floats ?

you don't only loose float resolution, but also clip input range

Guilherme Viana's icon

Hi! I've come across both coll and pattr objects, and tried to use them. However, I couldn't really understand how they work, even after looking at their help patcher. Therefore, I used this "rudimentary" method as it was based on what I learned in class.

Also, thank you for the detection method, worked like a charm! Oh, and those sliders I had for each expression were just so that I could see them change; I wasn't looking into using them in the actual detection method.

Source Audio's icon

I'd be glad to help you with coll or pattr,

but explain a bit more about how you want to use this parameters.

is it for live or pure max, do you need several presets,

do you need automation and so on.

Guilherme Viana's icon

Ok, so basically, my starting point is a tutorial by Ned Rush. I built a sound system just like he did, and now I want detected facial expressions to dynamically alter the sound by switching between different parameter sets.

To achieve this, each expression triggers a unique set of three values. These values feed into the three input floats of the Selector~ to change the sound. Each expression needs a 'default' state (triggered by the loadbang messages), but I also want the ability to override those values live using touchOSC sliders. For this to stay coherent, I want the mobile interface to stay in sync with the defaults on load, but remain fully interactive so I can tweak the 'Happy' or 'Neutral' presets on the fly."

I already used touchOSC in a previous project, so I know how to map buttons and values. I will do that at a later stage. I'm also thinking of using the detection of presence to turn the tempo on/off, so the sound stops or starts if a person is detected, and using presets for the visual component (colours, size, scale, shape, thershold, ...)

Now that I have an "audiovisual basis" it's more about playing and see what interesting things I can do with this API data and stuff. Btw, keep in mind my knowledge on Max is very limited. Many thanks!!

(the patcher is a bit all over the place since I'm just experimenting stuff)

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