summaryrefslogtreecommitdiff
path: root/client
diff options
context:
space:
mode:
Diffstat (limited to 'client')
-rw-r--r--client/index.js4
-rw-r--r--client/lib/midi.js13
2 files changed, 12 insertions, 5 deletions
diff --git a/client/index.js b/client/index.js
index 527fb64..2c9716a 100644
--- a/client/index.js
+++ b/client/index.js
@@ -125,13 +125,13 @@ function play_mass_shootings(i, bounds, diff, note_time, channel="all", exportin
timings = [64, 64]
break
case 3:
- midi_notes.push(play_note( norm(notes[0], min, max) * nx.multiply.value, 43, channel, exporting, mass_rest))
+ midi_notes.push(play_note( norm(notes[0], min, max) * nx.multiply.value, 43, channel, exporting, mass_rest, 0))
midi_notes.push(play_note( norm(notes[1], min, max) * nx.multiply.value, 43, channel, exporting, 0, 43))
midi_notes.push(play_note( norm(notes[2], min, max) * nx.multiply.value, 42, channel, exporting, 0, 85))
timings = [43, 43 ,42]
break
case 4:
- midi_notes.push(play_note( norm(notes[0], min, max) * nx.multiply.value, 32, channel, exporting, mass_rest))
+ midi_notes.push(play_note( norm(notes[0], min, max) * nx.multiply.value, 32, channel, exporting, mass_rest, 0))
midi_notes.push(play_note( norm(notes[1], min, max) * nx.multiply.value, 32, channel, exporting, 0, 32))
midi_notes.push(play_note( norm(notes[2], min, max) * nx.multiply.value, 32, channel, exporting, 0, 64))
midi_notes.push(play_note( norm(notes[3], min, max) * nx.multiply.value, 32, channel, exporting, 0, 96))
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])