Sensor values to midi notes
Hello everyone,
I have a circuit with an ultrasonic sensor and a MAX patch that collects the data from the sensor and gives me 0-127 output values that I use to control sound in Ableton Live. I need the patch to output the values as MIDI notes, so that the whole would act as a string instrument. By that I mean any change in values lead to producing a MIDI note, corresponding with the values read by the sensor. Do you have any ideas on how it should be done?
Have a nice day,
Osmo
Hi Bart,
Thank you for your suggestion!
I plugged the pitch and velocity input of the noteout object to the sensor output and the sound effect was pretty interesting (in an experimental way) – the keys in my VST instruments would be pressed and held. But to achieve more stable effect I would need the keys to be pressed and released.
I would need it to behave like this – if I hold my hand in a position which is recognized by the sensor as "127", the virtual key is pressed and held as long as my hand stays at the position. But if I move my hand away, for example to position recognized as "50", the note corresponding to position "127" is automatically released and the note corresponding to position "50" – pressed instead.
Any ideas?
Edit: I add my developing patch in the attachment.
All best,
Osmo
To get note pitch values from your sensor reading, you can simply use a scale object. You can check what lower and upper numerical values you get from the sensor and then scale those to [0 .. 127]. That's part 1 of your question.
As for part two: it sounds like you want your instrument to behave monophonically. This can easily be accomplished with the noteout object. You just need a way for the patch to remember the current playing note, so you can send it a velocity 0. In the example below I've used an int object to do just that. It works like a charm, with Ableton Live listening to MIDI input from Max via the "from Max 1" interface.
Have fun!
@Osmo Nadir - I think you're looking for the "makenote" object, which you plug into noteout.
Thank you guys!
HZ37: I plugged your patch to the sensor output, it works exactly as I needed it to. Huge thanks!
Wetterberg: Thank you for the suggestion, I will give it a try as soon as I stop playing with HZ37's patch!
All best,
Osmo
Hi Osmo, great that you combined it! Could you share the final patch as well maybe?
thanks, best,
Konstantina
What are you trying to achieve, Konstantina? Maybe write a post.