Dynamic Message Routing - inspiration needed

mudang's icon

Hi fellow maxers,

I'm looking for an elegant solution for the following scenario:

I've got a lot of incoming controller data in the form of message streams.
I need to map these messages dynamically (changing over time) to different sound-generating modules.
The routing should be set with symbols.
For example: controllerB::X_speed -> synthA::Pitch.
One-to-Many routing should be possible.

Probably I'll also need to insert some kind of transformer to adjust the controller value ranges...

My first idea was to use a combination of [router] and the pattr system.

Maybe some of you have found an elegant system for this?
Maybe javascript or java ?
3rd party externals ?

cheers & thx,
jan.

pdelges's icon

router controlled with a matrix and eventually the pattr seems elegant enough to me.

I would also map all controllers into the 0.-1. range to get an uniform interface. Then I'd do a mapping into the modules for each parameters.

p

Roman Thilenius's icon

[poly~ gate 32]

dhjdhjdhj's icon

Attach a uniquely named [receive ...] to the input of each parameter you want to control.

Attach each controller data output to unique [foward ] objects.

The nice thing about [foward] is that you can dynamically change the recipient name so all you have to do is change the names on the fly to cause the data to go to a different parameter.

The suggestion to scale everything between 0 and 1 is an excellent one.

geddonn's icon

Nice tips here, I'm coming doing something similar myself, the [forward] object is great for this, I also find if you can get your data onto a jitter matrix you can do some excellent stuff with [jit.gen] and things like [jit.slide] can add some nice touches to your data.

Also [histo] and [table] are great for probability based routing.

mudang's icon

thanks for the tips guys :)
I think I'll dwell more deeply into the pattr system.
I've always seen it as a more stable preset replacement - but now I've realized that there's really more to it.

You can do routing by binding pattr objects to other pattr objects.
The parameter mode is also new to me.

Even after years, there's always something new to discover in max :))

dhjdhjdhj's icon

I seriously considered the pattr stuff but frankly I was unable to make head or tail of it.

In the end I came up with a simple scheme using a name hierarchy (as objects get nested) and everything just feeds into a simple javascript dictionary object that's managed centrally. With that, I've got completely persistence with automatic saving and reloading of parameter values for sliders and dials.

The ability to set the target of a [forward] object was critical to being able to do this and it works really nice.

mudang's icon

What do you exactly mean with javascript dictionary object?
I think I'll need something similar. Some sort of central manager.
Auto-populating an umenu with the available parameters would also be a nice thing to have...

I want to stick to max5, so I can't use the dict object...

willyc's icon

This patch demonstrates using the pattr system to acheive some of the requirements mentioned in the thread:

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

- dynamically choosing a 'target' for a 'control stream'
- scaling control range to target range (in this patch, the scaling will only work for targets that have a 'minimum' and 'maximum' attribute)
- auto-populating umenus with potential targets

mudang's icon

wow, that's brilliant.
thanks for sharing!!