Forums > MaxMSP

notein and kslider, stop sound when release on keyboard

January 11, 2011 | 4:39 pm

Ive tried searching but cant find out how to do this.

Im trying to make a synth patch, how can i make it so sound plays when a key is pressed and stops when released? Ive got notein-kslider-mtof, what do i add?

Can anyone help please?

January 11, 2011 | 10:35 pm

Have a nosey round the examples folder inside your Max/Cycling74 folder; there’s many midi-synth examples.

A quick fix for this is to use the note-off velocity from your keyboard (I assume you mean an external midi keyboard); when the key is released it sends a velocity of zero. Use [sel 0]-> message[0 50]->[line]->[*~] and multiply the output of your oscillator or sound source by this ramp.

Also look at the helpfile for [makenote] and the handy little "See Also" box in the helpfiles.

January 12, 2011 | 1:23 am

Definitely have a look to see how the examples achieve this. You might also want to look at other midi processing objects like [stripnote] (in conjunction with [sel 0] for note-offs) and envelope generators like [function] and [adsr~].

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