Number~ MIDI format, printing input

G Mrln's icon

Hello,

I am using the number~ in MIDI C4 format for notes extraction. Even if I get the notes within the object, I would like to print them in the MAX console and use the results further. However they are being printed as numbers and I haven't managed to either print them in MIDI format or find the matching of numbers to MIDI notes.
Does anyone has any ideas?
Thank you.

Christopher Dobrian's icon

I think you mean number, not number~. number has a format attribute, number~ does not. The display format is just that, a display format; the number remains a number despite how it's displayed by that object. The number, a MIDI pitch, is a message of type 'int', whereas something like 'C4' is a message of type 'symbol'. It's seen as a word, not a number. To my knowledge there's no object that automatically converts an int into a corresponding MIDI note name symbol. You'd have to program it yourself. Fortunately that's not hard to do. Rather than write a program to generate the correct symbol algorithmically, it will be much quicker and easier just to create a lookup table using the coll object. I did the first octave for you. Took me about a minute to enter in the data. You can thus do the rest in about ten minutes. (Double-click on the coll object, enter the remaining text in the format shown, save.)

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