Output specific symbol (text) upon receiving a certain number

Timo's icon

Hey all,

I'm not seeing/finding the obvious and easy answer to this small problem.

I have a dial object which outputs numbers from 0 to 5. The numbers are being used on a selector object.
What second object do I have to attach to the dial to output some arbitrary text to e.g. the print object?

In my "example" I want to output "zero" when a 0 is sent, "foobar" when a 1 is sent, etc.:

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

Thank you for helping
Timo

Pedro Santos's icon

Use a [coll @embed 1] object.
The syntax is input, output. See the help file for more information.
Example:
0, 0;
1, foobar;
2, other_message;
...

Timo's icon

Thank you!
That did the trick.

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

File waveForms.txt:
0, Off;
1, Sine;
2, Triangle;
4, Square;
3, Saw;

Pedro Santos's icon

Any reason to use a separate txt file for the list? If you use the coll object with the "@embed 1" attribute as recommended, the list is saved inside the Max patch.
On a side note, if you want to also control the list directly, instead of slider you could use other UI objects, such as umenu or tab.

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


Timo's icon

Hey!
I switched to [coll @embed 1].
Here's my complete patch. Would love your feedback. There are definitly parts that could be implemented in easier and more straightforward ways.

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