Download MetaTrader 5

Libraries: CMIDI

To add comments, please log in or register


The class to play music using the MIDI device

Music program

Music program is recorded in the string array. In one array element is written a list of actions. Actions are written by a comma. At first a command, an equal sign and a command value are written. The following commands are available:

  • Tick - time in milliseconds through which all the commands of one array element will be performed. It defines the temp with which the play is performed.
  • Volume - the volume level, from 0 to 100.
  • VolumeL - the left channel volume level, from 0 to 100.
  • VolumeR - the right channel volume level, from 0 to 100.
  • Instrument - selection of the music instrument, from 0 to 127.
  • NoteDN - press a key. Number 60 corresponds to "do" note of the main octave, 61 - to "C sharp", 62 - to "re", etc.
  • NoteUP - release a key. For several instruments you cannot use release a key, the sound fades away itself, and for some keys it is obligatory to press.

It is possible to take chords, for example, "NoteDN=57, NoteDN=60, NoteDN=64". A possible parallel play on several instruments, for example, "Instrument=1, NoteDN=60, Instrument=123, NoteDN=60". Different instruments' volume can not be changed, all is played on the same volume, but you can change the volume of different parts of playing, for example:

Author: Dmitry Fedoseev

To add comments, please log in or register