Tonejs / Midi

Convert MIDI into Tone.js-friendly JSON
http://tonejs.github.io/Midi/
MIT License
871 stars 116 forks source link

I am not able to add silences in a track #166

Open francowanseele opened 1 year ago

francowanseele commented 1 year ago

Hello! I have been working with this tool since a long time.

I am creating tracks with different sounds and works perfect! But I want to introduce silences and I can't.

To add notes I do the following:

track.addNote({
    name: nota,
    time: timeStart + timePartialSec,
    duration: figuraSec,
});

And to add silences I try with the following, but instead of silences, a strange sound is played in the background

track.addNote({
    midi: 0,
    time: timeStart + timePartialSec,
    duration: figuraSec,
});

Any idea how to make silences appear?

Thank you 💪

Guseyn commented 1 year ago

For now I am using very high octave like 20 to make a sound silent. It's my temporary workaround, in the future I would probably use dynamic effects, not quite sure how yet.

Guseyn commented 1 year ago

@francowanseele I think I found how to manipulate volume, it's a control change with number 7, here is the full list of those control changes: https://nickfever.com/music/midi-cc-list Also you can find in Readme file in this repo how you can add those in the track. I suspect the value for this control change should be 0, but I am not 100% sure. I need to test it, but you can also try. I think that manipulation with high octave is much easier in some cases, but it's up to you to decide.