To change a specific number in a list in Max/MSP
Hello,
I have a question. I want to convert texts to ASCII codes and then output 1 if it corresponds to 'a', 'e', 'i', 'o', or 'u', otherwise output 2. For example, if I input "book" with the atoi object, it converts to ASCII codes 98 111 111 107. If these values correspond to the ASCII codes for 'a', 'e', 'i', 'o', 'u' (97, 101, 105, 111, 117), it should output 1, otherwise 2. So, the letters in "book" should be output as "2 1 1 2". Could you please let me know how to do this? Thank you very much.
you will use sel, i will use expr:
[if ($i1==97) || ($i1==101) || ($i1==105) || ($i1==111) || ($i1==117) then 1 else 2]
[expr ( 2 - ($i1==97) || ($i1==101) || ($i1==105) || ($i1==111) || ($i1==117) )]
Thank you for your response. My issue might be that the numbers are in a list, and I need to apply the if statement to each number individually. Is it possible to use $i1 for this? It might be difficult to convey the meaning through my text-based question alone, so I've attached an example which might be helpful. Thank you.
@SOURCE AUDIO Wow, this is amazing! Thank you very much!
I'm personally curious if it's possible to apply an if statement to individual numbers in a number list?
if you use vexpr instead of expr, that one will also process lists.

but otherwise you can always do [iter] to the list in that situation.
oh I see. This is great! Thanks Roman.