grimmdude / MidiWriterJS

♬ A JavaScript library which provides an API for programmatically generating and creating expressive multi-track MIDI files and JSON.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Why does a slower tempo create a little rest between NoteEvents?

AndaRebeca opened this issue · comments

commented

I have a track with 4 chords having:
time signature: (4/4)
bpm (tempo): 120
duration of the NoteEvent : "T512"

When I change the bpm to 60, a little rest appears between chords. How can I make the chords play cursively as when I have a bpm of 120?
@grimmdude

This is happening to us as well for the same configuration.
Any help? @grimmdude

Hi @AndaRebeca & @marian-simonca, I can't seem to replicate this issue. When I create a MIDI file using those parameters I end up with each chord being held for a whole note as I would expect, given that each beat consists of 128 ticks.

Here's the code I'm using, can you post your code?

const MidiWriter = require('midi-writer-js');

const track = new MidiWriter.Track();

track.setTempo(60);
track.setTimeSignature(4, 4);

track.addEvent([
	new MidiWriter.NoteEvent({pitch: ['C4', 'E4','G4'], duration: 'T512'}),
	new MidiWriter.NoteEvent({pitch: ['C4', 'E4','G4'], duration: 'T512'}),
	new MidiWriter.NoteEvent({pitch: ['C4', 'E4','G4'], duration: 'T512'}),
	new MidiWriter.NoteEvent({pitch: ['C4', 'E4','G4'], duration: 'T512'}),
]);

const write = new MidiWriter.Writer(track);
console.log(write.dataUri());