How to change the pitch and volume of MIDI note in Delphi?

I found a solution const MIDI_NOTE_ON = $90; MIDI_NOTE_OFF = $80; MIDI_CHANGE_INSTRUMENT = $C0; MIDI_PITCH_BEND = $E0; function MIDIEncodeMessage(Msg, Param1, Param2: byte): integer; begin result := Msg + (Param1 shl 8) + (Param2 shl 16); end; procedure TForm4. FormClose(Sender: TObject; var Action: TCloseAction); begin midiOutClose(hMidi); end; procedure TForm4. FormCreate(Sender: TObject); begin playing := false; midiOutOpen(@hMidi, 0, 0, 0, CALLBACK_NULL); midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_CHANGE_INSTRUMENT, 19, 0)); end; procedure TForm4.

FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if playing then Exit; ProgressBar1. Position := $2000; midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_PITCH_BEND, lo(ProgressBar1. Position), hi(ProgressBar1.

Position))); midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_NOTE_ON, 50, 127)); playing := true; end; procedure TForm4. FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_NOTE_OFF, 50, 127)); playing := false; end; procedure TForm4. FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); begin ProgressBar1.

StepBy(4*WheelDelta); midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_PITCH_BEND, lo(ProgressBar1. Position), hi(ProgressBar1. Position))); end Drop a TProgressBar on the form, and set its Min and Max to 0 and 16383 respectively Then you can 'bend' the pitch by scrolling your mouse wheel.(Notice that the factor 4 I use when handling the mouse wheel might be unsuitable for your mouse and your current mouse settings.) Sample: pitchbend.exe.

I found a solution. Const MIDI_NOTE_ON = $90; MIDI_NOTE_OFF = $80; MIDI_CHANGE_INSTRUMENT = $C0; MIDI_PITCH_BEND = $E0; function MIDIEncodeMessage(Msg, Param1, Param2: byte): integer; begin result := Msg + (Param1 shl 8) + (Param2 shl 16); end; procedure TForm4. FormClose(Sender: TObject; var Action: TCloseAction); begin midiOutClose(hMidi); end; procedure TForm4.

FormCreate(Sender: TObject); begin playing := false; midiOutOpen(@hMidi, 0, 0, 0, CALLBACK_NULL); midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_CHANGE_INSTRUMENT, 19, 0)); end; procedure TForm4. FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); begin if playing then Exit; ProgressBar1. Position := $2000; midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_PITCH_BEND, lo(ProgressBar1.

Position), hi(ProgressBar1. Position))); midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_NOTE_ON, 50, 127)); playing := true; end; procedure TForm4. FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); begin midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_NOTE_OFF, 50, 127)); playing := false; end; procedure TForm4.

FormMouseWheel(Sender: TObject; Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean); begin ProgressBar1. StepBy(4*WheelDelta); midiOutShortMsg(hMidi, MIDIEncodeMessage(MIDI_PITCH_BEND, lo(ProgressBar1. Position), hi(ProgressBar1.

Position))); end; Drop a TProgressBar on the form, and set its Min and Max to 0 and 16383, respectively. Then you can 'bend' the pitch by scrolling your mouse wheel. (Notice that the factor 4 I use when handling the mouse wheel might be unsuitable for your mouse and your current mouse settings.) Sample: pitchbend.exe.

Thank you so much! This is exactly what I need to work with pitch. What about fade-out (-in) effect?

Is it possible to change the velocity of separate note while it is playing? I did not find any information about midi message similar to pitch bend that can regulate velocity.. – VIK Jul 30 at 21:20 @VIK: Velocity is a one-off value sent at the start of the note. However "Control Change" messages can be sent continuously."Control Change" #7 is reserved for volume changes.

See David's MIDI Spec for an easy to read reference. Srm.Com/qtma/davidsmidispec. Html – Shannon Jul 31 at 3:13 @Shannon: Thank you for the useful link.

– VIK Jul 31 at 14:46 Cool. I didn't know it was so easy to use Midi in Windows. – Rudy Velthuis Jul 31 at 19:11 @Rudy: It really is easy.

– Andreas Rejbrand Jul 31 at 19:13.

You are looking for the pitch bend message. First four bits are 1110 and the next four indentify the channel. The next two bytes are MSB and LSB for a 14-bit pitch bend value.(First bit is always 0.) The "center" value of the pitch bend stick is 8192.

For example, lowest bend point on channel one: 11100000 00000000 00000000 How much the pitch goes up and down is entirely up to the synthesizer. Many synths support changing this range with an RPN, but not all.

You are looking for the pitch bend message. First four bits are 1110 and the next four indentify the channel. The next two bytes are MSB and LSB for a 14-bit pitch bend value.

The "center" value of the pitch bend stick is 8192. How much the pitch goes up and down is entirely up to the synthesizer. Many synths support changing this range with an RPN, but not all.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions