Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to add note pauses? #22

Open
zettam opened this issue Sep 10, 2016 · 3 comments
Open

How to add note pauses? #22

zettam opened this issue Sep 10, 2016 · 3 comments

Comments

@zettam
Copy link

zettam commented Sep 10, 2016

I would like to add silent notes (pauses) directly just like I can add a d4 or any other note. I'm unable to find this in documentation. Any help would be appreciated.

@zettam
Copy link
Author

zettam commented Sep 10, 2016

"rest" it is called I believe

@walmik
Copy link
Contributor

walmik commented Jan 28, 2017

You can set the note to be an empty string in case you want to add a rest. So for instance,

track.noteOff(0, '', 64);

In there ^ 0 implies channel number, '' implies don't play any note and 64 implies, do this for 2 beats (assuming it s a 16 beat bar)

@pateketrueke
Copy link

Seems like this does not works on the beginning of the track:

// test.js
const jsmidgen = require('jsmidgen');
const track = new jsmidgen.Track();
const file = new jsmidgen.File();

file.addTrack(track);

track.noteOff(0, '', 100);
track.noteOff(0, '', 100);
track.noteOff(0, '', 100);

track.noteOn(0, 'c2', 100, 100);
track.noteOff(0, 'c2', 100, 100);

require('fs').writeFileSync('output.midi', file.toBytes(), 'binary');

It always start playing on c2, no matter how many track.noteOff(0, 'c2', 100, 100); I put before.

$ node test.js && timidity output.mid

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants