grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.
MIT License
547 stars 58 forks source link

how to play through stem? #38

Closed lingxinc closed 9 months ago

lingxinc commented 6 years ago

how to play through stem? 35836544-c45b9724-0b1b-11e8-8e0b-ba7db8342036

grimmdude commented 6 years ago

Hi @lingxinc,

Can you clarify your question a bit?

-Garrett

lingxinc commented 6 years ago

I'm sorry, I am working hard on my Englishl! I want to ask how to add a note with vibrato.

grimmdude commented 9 months ago

Hi @lingxinc,

You can use a ControllerChangeEvent to apply modulation to your track, which could be used as vibrato. The controllerNumber for modulation is 1 and the range for the controllerValue is 0 - 127.

const track = new MidiWriter.Track();

track.addEvent([
    new MidiWriter.ControllerChangeEvent({controllerNumber: 1, controllerValue: 127}),
    new MidiWriter.NoteEvent({pitch: 'C4', duration: '2'}),
]);