Forums > MaxMSP

Problem with the set/match function (or select)

Mar 05 2012 | 4:06 pm

Hi, Im completely new to max msp, please forgive me if I’m doing this wrong. Im trying to program an ear training tool. What Ive planned is to use tables of scales and randomly generate notes from the scale to create a 4 note melody/phrase and then the user has to play it back to match it via MIDI. Im using the set and match function to confirm the user’s correct input in it’s entirety/correct sequence.

So far I’ve been able to set 4 predetermined notes and match it by user input which works fine, but this is not randomized. Id want to be able to randomize the numbers within the set message, and have tried using 4 $ numbers and connecting them to the output of the notes randomly generated from the table.

My other idea was to use the select function, which is fine for single note aural tests as it has one input for the function to match. Is there a way for select to use more than one number to match by the user?

Would really appreciate any help that anyone can offer! I know it may sound a bit difficuly to get at what I’m explaining at as it’s quite hard for me to explain in text without knowing that much about msp.

Thanks a lot.

  1. setmatcher.maxpat
Mar 05 2012 | 6:12 pm

Okay i think i got the solution to pack the numbers to set – in theory – but in practice it isn’t working. Ive packed the numbers then set them, but the two numbers at the input of match won’t bang out or match them. Im very confused as to why they are not matching?

-- Pasted Max Patch, click to expand. --

Mar 05 2012 | 6:54 pm

First off, Copy Compressed.

Second, in the example, with your set message you’re asking match to match those two numbers, in that order, or a list of those two numbers, not the two individual numbers.

Mar 05 2012 | 6:58 pm

^ Okay, sorry about that. Thanks for the response. I’m aware that the match is meant to be in the same order, but on entering the two numbers in the exact same order it still wouldn’t bang out. How would I go about matching a set of numbers ( a sequence) with the exact ordered input as the set number that would lead to a bang?

EDIT: So far ive only been able to match/bang more than 1 number if the inputs are messages. I’d preferably would like to use individual numbers and link them into a pack then to the set, but this doesn’t seem to be working.

-- Pasted Max Patch, click to expand. --

Also does this method work with more than 2 set numbers?

Mar 05 2012 | 7:29 pm

Your last couple of patches work for me. Here’s a slightly edited version of your back by one patch.

-- Pasted Max Patch, click to expand. --

Mar 05 2012 | 7:37 pm

Right, I must be doing something drastically wrong if mines are working. I can’t bang out on the one you made. Step by step this is what I do/did:

Change the two top number boxes to 1, 2.
Press set $1 $2
Then change the two lower number boxes to correspond to 1, 2.
Results to no bang.

I pressed the message numbers 1 and 2, but it still won’t bang.

Am I mistaken in my procedure of testing out my patch?

Mar 05 2012 | 8:06 pm

-- Pasted Max Patch, click to expand. --

Mar 05 2012 | 8:21 pm

I really do appreciate your time and patience taken Chris! Removing objects one by one, oddly enough the pak object is only object making the difference with my bangs. As soon as I revert it to ‘pack’ there is no bang, which leads me to suspect that the number order at the match input was the problem as now I am able to set 4 numbers + to match. How can I tell which order is the number inputs on match? For the program the user would need to follow the correct order of notes played you see.

***Correct me if Im wrong but the segmented patch cords seem to be ordering the number boxes according to their left-to-right order?

Mar 05 2012 | 8:30 pm

The think to keep in mind is that like almost all Max objects, pack only fires when it gets something in the left-most inlet.

pak is unusual in that it fires when it gets something in any inlet.

So the problem was probably something like: you were setting the left number box first, which sent the set message to match, then setting the right number box, which didn’t send a set message, but would be used next time the left most number box changed.

-- Pasted Max Patch, click to expand. --

Viewing 9 posts - 1 through 9 (of 9 total)

Forums > MaxMSP