Change amplitude of MIDI note over time
How can I change the amplitude of one MIDI note over time? I am new with MSP. I intend to make one MIDI note last about 4 seconds and I can change the amplitude of the MIDI note during that 4 secs. How can I do that? Please help me! Thank you so much!
Dont think you can. MIDI messages are pretty simple. Note On- Note Off. Your better off changing whatever you want that MIDI note to control. For instance if you have the MIDI note Triggering a synth and you want the volume to decrease over the 4 seconds - then change the volume over the course of the 4 seconds...
Hardware-wise, some synths (such as ones that adhere to GM or XG standards) allow you to do this by changing CC 11 (expression).
If it's a VSTi, then you could automate the output volume as Mikey suggests with a [line~].
You can change the sustained volume of a note using [ctlout 7 1] for channel 1, etc. Send it a value from 0 to 127 as usual in MIDI land. This will scale the original level that's determined by the note-on velocity.
The other advice given here is also good and allows other methods to change the volume (after it's been used to trigger an actual audio signal, which you could then utilize line~ or a bunch of other methods to vary it). Directly in Max there isn't a way to "grab" the noteout and utilize it as audio (though I wish there was and if I'm missing something, please advise :) However, using something like Soundflower on Mac OS will let you route the sound back into Max to mangle as audio/MSP. Not sure about a Windows alternative, perhaps MIDIOX, which I've heard good things about but haven't tried.
Example patch and screenshot if you're on 4:
Thank you all for your reply! I will try the synth as you suggest. But when using the synth to change amplitude, does it change the amplitude of the whole instrument? Because my intention is to change the amplitude of one single MIDI note.
The above message is correct about individual notes, midi controller messages are monophonic except for note on, note off, and polyphonic aftertouch messages; and polyphonic aftertouch is very rarely supported.