diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2018-10-08 01:05:13 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2018-10-08 01:05:13 +0200 |
| commit | 9e824cc6d358fc902b27e00e5a1e8f88e3610823 (patch) | |
| tree | b2aa1f0e514ddcc9a6843ba42481b75ae7127329 /client/lib/midi.js | |
| parent | 81adbc30b2dbf9a24917694e22042762a930e00d (diff) | |
group and midi stuff
Diffstat (limited to 'client/lib/midi.js')
| -rw-r--r-- | client/lib/midi.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/client/lib/midi.js b/client/lib/midi.js index 05fd708..f2e0295 100644 --- a/client/lib/midi.js +++ b/client/lib/midi.js @@ -1,10 +1,13 @@ import Tone from 'tone' import WebMidi from 'webmidi' import scales from './scales' -import { ftom } from './util' +import { ftom, norm } from './util' import kalimba from './kalimba' +import { nx } from './ui' + let midiDevice +let sendPitchBend = false export const MidiWriter = require('midi-writer-js') @@ -81,7 +84,7 @@ export function play_note(index, duration, channel="all", exporting=false){ /* play the next note in sequence */ -function play_sequence(i, bounds, note_time, channel="all") { +export function play_sequence(i, bounds, diff, note_time, channel="all", exporting) { const { rows, min, max } = bounds const count = rows.length * rows[0].length if (i >= count) i = 0 @@ -97,7 +100,7 @@ function play_sequence(i, bounds, note_time, channel="all") { /* play the next row as an interval */ -function play_interval_sequence(i, bounds, note_time, channel="all") { +export function play_interval_sequence(i, bounds, diff, note_time, channel="all", exporting) { const { rows, min, max } = bounds const count = rows.length if (i >= count) i = 0 @@ -118,7 +121,7 @@ function play_interval_sequence(i, bounds, note_time, channel="all") { /* generate a 1-track midi file by calling the play function repeatedly */ -function export_pattern_as_midi(datasetName, bounds, tempo, timingIndex, play_fn) { +export function export_pattern_as_midi(datasetName, bounds, diff, tempo, timingIndex, play_fn) { const behavior = document.querySelector('#behavior').value const { rows } = bounds let count = behavior === 'sequence' ? rows[0].length * rows.length : rows.length @@ -128,7 +131,7 @@ function export_pattern_as_midi(datasetName, bounds, tempo, timingIndex, play_fn let midi_track = new MidiWriter.Track() midi_track.setTempo(tempo) for (let i = 0, len = count; i < len; i++) { - notes = play_fn(i, bounds, exporting = true)[1] + notes = play_fn(i, bounds, note_time, "all", true)[1] if (timing.length) { note_time = timing[i % timing.length] } else { |
