Exemplo n.º 1
0
        public void AddNote(int track, int start, int length, byte key, DynamicValue dynamicValue, byte channel)
        {
            var velocity = MidiUtils.DynamicToVelocity(dynamicValue);

            AddEvent(track, start,
                     new MidiMessage(new[] { MakeCommand(0x90, channel), FixValue(key), FixValue((byte)velocity) }));
            AddEvent(track, start + length,
                     new MidiMessage(new[] { MakeCommand(0x80, channel), FixValue(key), FixValue((byte)velocity) }));
        }
        /// <inheritdoc />
        public void AddNote(int track, int start, int length, byte key, DynamicValue dynamicValue, byte channel)
        {
            var velocity = MidiUtils.DynamicToVelocity(dynamicValue);

            var noteOn = new MidiEvent(start, MakeCommand((byte)MidiEventType.NoteOn, channel), FixValue(key), FixValue((byte)velocity));

            _midiFile.AddEvent(noteOn);

            var noteOff = new MidiEvent(start + length, MakeCommand((byte)MidiEventType.NoteOff, channel), FixValue(key), FixValue((byte)velocity));

            _midiFile.AddEvent(noteOff);
        }