diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-10-10 13:42:55 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-10-10 13:42:55 +0200 |
| commit | a64c4fa7e1913fe14124190086d0d5624445c808 (patch) | |
| tree | 878763e84ac0519d0b036a67dd79b1b21f0e1933 /client/index.js | |
| parent | 0bb5cc4661bea6f8cf89ec4f4a109aa63630b668 (diff) | |
midi??
Diffstat (limited to 'client/index.js')
| -rw-r--r-- | client/index.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/client/index.js b/client/index.js index 4740db0..527fb64 100644 --- a/client/index.js +++ b/client/index.js @@ -1,6 +1,5 @@ import Tone from 'tone' import Nexus from 'nexusui' -import { saveAs } from 'file-saver/FileSaver' import keys from './lib/keys' import scales from './lib/scales' @@ -102,7 +101,7 @@ function play_mass_shootings(i, bounds, diff, note_time, channel="all", exportin const x = i % rows[0].length const n = rows[y][x] const total = dataset.dates.length - let notes = [], midi_notes = [], cases = [] + let notes = [], midi_notes = [], cases = [], timings console.log(i, mass_i, dataset.dates[mass_i]) while (i >= dataset.dates[mass_i] && mass_i < total) { notes.push(dataset.lines[0][mass_i]) @@ -118,21 +117,25 @@ function play_mass_shootings(i, bounds, diff, note_time, channel="all", exportin break case 1: midi_notes.push(play_note( norm(notes[0], min, max) * nx.multiply.value, 128, channel, exporting, mass_rest, 0)) + timings = [128] break case 2: midi_notes.push(play_note( norm(notes[0], min, max) * nx.multiply.value, 64, channel, exporting, mass_rest, 0)) midi_notes.push(play_note( norm(notes[1], min, max) * nx.multiply.value, 64, channel, exporting, 0, 64)) + 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[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[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)) + timings = [32, 32, 32, 32] break } if (cases.length) { @@ -148,10 +151,10 @@ function play_mass_shootings(i, bounds, diff, note_time, channel="all", exportin kalimba.play(220, -12) if (notes.length) { mass_rest = 0 - return [i, midi_notes] + return [i, midi_notes, timings, mass_rest] } mass_rest += 128 - return [i, []] + return [i, [], [], 0] } /* play next note according to sonification */ @@ -159,7 +162,7 @@ function play_mass_shootings(i, bounds, diff, note_time, channel="all", exportin function play_next(){ let note_time = 120000 / Tone.Transport.bpm.value * note_values[nx.timing.active][0] setTimeout(play_next, note_time) - let [new_i, notes] = play_fn(i, bounds, diff, note_time) + let [new_i, notes, timings] = play_fn(i, bounds, diff, note_time) i = new_i if (recording) { let timing = note_values[nx.timing.active][2] |
