summaryrefslogtreecommitdiff
path: root/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'bundle.js')
-rw-r--r--bundle.js82
1 files changed, 47 insertions, 35 deletions
diff --git a/bundle.js b/bundle.js
index b16e8c6..f79c9b0 100644
--- a/bundle.js
+++ b/bundle.js
@@ -34550,8 +34550,8 @@ function midi_ready(err) {
var i = 0;
data.load().then(function (lists) {
// nx.dataset.choices = Object.keys(lists)
- // console.log(lists)
- var list = lists.household_wealth;
+ console.log(lists);
+ var list = lists.weekly_earnings;
document.querySelector('#dataset_name').innerHTML = list.name.replace(/-/g, ' ');
// playSequence(list)
playIntervalSequence(list);
@@ -34566,7 +34566,7 @@ function playSequence(list) {
var count = rows.length * rows[0].length;
playNext();
function playNext() {
- var note_time = 30000 / _tone2.default.Transport.bpm.value;
+ var note_time = 120000 / _tone2.default.Transport.bpm.value * note_values[nx.timing.active][0];
setTimeout(playNext, note_time);
var y = Math.floor(i / rows[0].length);
var x = i % rows[0].length;
@@ -34605,10 +34605,6 @@ function playIntervalSequence(list) {
}
}
-// function pick_dataset(name){
-// i = 0
-// // dataset
-// }
function norm(n, min, max) {
return (n - min) / (max - min);
}
@@ -34646,7 +34642,8 @@ function get_bounds(dataset) {
}
function play(index, duration) {
// console.log(index)
- var freq = _scales2.default.current().index(index + Math.round(nx.offset.value));
+ var scale = _scales2.default.current();
+ var freq = scale.index(index + Math.round(nx.offset.value), nx.octave.value);
var midi_note = (0, _util.ftom)(freq);
var cents = midi_note % 1;
if (cents > 0.5) {
@@ -34655,10 +34652,11 @@ function play(index, duration) {
}
cents *= 2;
midi_note = Math.floor(midi_note);
- // console.log(freq, midi_note, cents.foFixed(1))
if (midi) {
+ if (midi_note > 127) return;
+ var note = _tone2.default.Frequency(Math.floor(midi_note), "midi").toNote();
duration = duration || 60000 / _tone2.default.Transport.bpm.value;
- midi.playNote(_tone2.default.Frequency(Math.floor(midi_note), "midi").toNote(), "all", { duration: duration });
+ midi.playNote(note, "all", { duration: duration });
// cents
// midi.sendPitchBend(cents, "all")
} else {
@@ -34667,6 +34665,32 @@ function play(index, duration) {
}
(0, _util.requestAudioContext)(ready);
+function update_value_on_change(el, id, is_int, fn) {
+ var label = document.querySelector(id + ' + .val');
+ var update = function update(v) {
+ label.innerHTML = is_int ? parseInt(v) : v.toFixed(2);
+ fn && fn(v);
+ };
+ el.on('change', update);
+ update(el.value);
+ el.update = update;
+}
+function update_radio_value_on_change(el, id, values, fn) {
+ var old_v = el.active;
+ var label = document.querySelector(id + ' + .val');
+ var update = function update(v) {
+ if (v === -1) {
+ v = el.active = old_v;
+ } else {
+ old_v = v;
+ }
+ label.innerHTML = values[v][1];
+ fn && fn(v);
+ };
+ el.on('change', update);
+ update(el.active);
+ el.update = update;
+}
function ready() {
_scales2.default.build_options(document.querySelector('#scale'));
// nx.colorize('#f4d142')
@@ -34705,6 +34729,14 @@ function ready() {
});
update_value_on_change(nx.offset, '#offset', true);
+ nx.octave = new _nexusui2.default.Dial('#octave', {
+ min: -4,
+ max: 4,
+ step: 1,
+ value: 0
+ });
+ update_value_on_change(nx.octave, '#octave', true);
+
nx.multiply = new _nexusui2.default.Dial('#multiply', {
min: -64,
max: 64,
@@ -34724,31 +34756,11 @@ function ready() {
_tone2.default.Transport.start();
document.querySelector('.loading').classList.remove('loading');
}
-function update_value_on_change(el, id, is_int, fn) {
- var label = document.querySelector(id + ' + .val');
- var update = function update(v) {
- label.innerHTML = is_int ? parseInt(v) : v.toFixed(2);
- fn && fn(v);
- };
- el.on('change', update);
- update(el.value);
-}
-function update_radio_value_on_change(el, id, values, fn) {
- var old_v = el.active;
- var label = document.querySelector(id + ' + .val');
- var update = function update(v) {
- if (v === -1) {
- v = el.active = old_v;
- } else {
- old_v = v;
- }
- label.innerHTML = values[v][1];
- fn && fn(v);
- };
- el.on('change', update);
- update(el.active);
-}
-_keys2.default.listen(play);
+
+_keys2.default.listen(function (index) {
+ nx.offset.value = index;
+ nx.offset.update(index);
+});
/***/ }),
/* 9 */