From 4378f977c385f475826b9680ae4c705e5ebff910 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 10 Oct 2018 14:13:15 +0200 Subject: deploy --- client/lib/midi.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'client/lib/midi.js') diff --git a/client/lib/midi.js b/client/lib/midi.js index 3b07cb0..d51aeff 100644 --- a/client/lib/midi.js +++ b/client/lib/midi.js @@ -71,7 +71,10 @@ export function play_note(index, duration, channel="all", exporting=false, rest= const note = Tone.Frequency(Math.floor(midi_note), "midi").toNote() const defer_time = 30000 / Tone.Transport.bpm.value * defer / 128 console.log(defer, defer_time) - if (exporting || midiDevice) { + if (exporting) { + return note + } + if (midiDevice) { duration = duration || 60000 / Tone.Transport.bpm.value if (! exporting) { if (defer) { @@ -157,9 +160,13 @@ export function export_pattern_as_midi(datasetName, bounds, diff, tempo, timingI // note_time = timing // } // midi_track.addEvent(new MidiWriter.NoteEvent({ pitch: notes, duration: 't' + note_time })) - console.log(i, notes, timings) + console.log(i, notes, timings, wait) for (let j = 0; j < notes.length; j++) { - midi_track.addEvent(new MidiWriter.NoteEvent({ pitch: notes[j], duration: 't' + timings[j], wait })) + midi_track.addEvent(new MidiWriter.NoteEvent({ + pitch: notes[j], + duration: 't' + timings[j], + wait: (j === 0) ? wait : 0, + })) } } const writer = new MidiWriter.Writer([midi_track]) -- cgit v1.2.3-70-g09d2