In generating Midi Track using C# Code, how Can I make the tone being played, not fading out?
I am building a small MIDI composer application, using the Stanford Library. It is almost complete, except for a开发者_如何学Python small problem: sound vanishes after the NoteOn
command, but I want notes to keep on playing until I release the button.
With MIDI, you should hear the note continue forever until you send a NoteOff command. If you're hearing a note begin but then fade out (without having sent a NoteOff message), then it might be that the channel is set to an instrument that naturally fades out on its own - like a marimba or steel drum sound.
That would be down to the MIDI device that you are addressing. You might be able to tell it to increase the sustain level of the envelope via MIDI NRPN or SysEx, but this would be device specific. Generally a string or pad voice will maintain a high sustain, whereas a piano or other percussive sound will consistently fade to zero regardless of sustain level.
So, you are saying that when you play a note it decays normally (as if you head down a piano key) and you don't want that?
That is a feature of the synthesizer and has nothing to do with MIDI. You will need to pick a patch that doesn't do this. Organ patches should work fine.
If instead you are saying that your note stops immediately (as if you hit the key and immediately released) then you have something sending a note-off command or a note command with 0 velocity. Check to make sure you are in fact sending 7-bit values for velocity and what not.
精彩评论