summaryrefslogtreecommitdiff
path: root/bundle.js
diff options
context:
space:
mode:
Diffstat (limited to 'bundle.js')
-rw-r--r--bundle.js47
1 files changed, 36 insertions, 11 deletions
diff --git a/bundle.js b/bundle.js
index 6220a37..37c654a 100644
--- a/bundle.js
+++ b/bundle.js
@@ -27197,8 +27197,8 @@ function get_bounds(dataset) {
/* transpose a 2D array */
function transpose(a) {
- var i_len = a.length,
- j_len = a[0].length;
+ var i_len = a[0].length;
+ var j_len = a.length;
var T = new Array(i_len);
for (var i = 0; i < i_len; i++) {
T[i] = new Array(j_len);
@@ -28781,6 +28781,10 @@ exports.update_value_on_change = update_value_on_change;
exports.update_radio_value_on_change = update_radio_value_on_change;
exports.build_options = build_options;
+var _nexusui = __webpack_require__(75);
+
+var _nexusui2 = _interopRequireDefault(_nexusui);
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var nx = exports.nx = window.nx = {};
@@ -30375,10 +30379,10 @@ var dataPromises = files.map(function (name) {
});
});
}).then(function (lines) {
- console.log(name, lines);
+ // console.log(name, lines)
var h = lines.shift();
return {
- name: name.replace(/_/g, ' '),
+ name: name,
h: h,
lines: lines.filter(function (s) {
return !!s;
@@ -30388,7 +30392,7 @@ var dataPromises = files.map(function (name) {
});
var allPromises = _promise2.default.all(dataPromises).then(function (data) {
return data.reduce(function (a, b) {
- console.log(b);
+ // console.log(b)
a[b.name] = b;
return a;
}, {});
@@ -40561,10 +40565,20 @@ var i = 0,
diff = [];
var play_fn = _midi.play_sequence;
data.load().then(function (lists) {
- // pick_dataset('mass shootings')
- // requestAudioContext(ready)
console.log(lists);
- (0, _midi.transpose)(lists.gun_violence_by_month.lines);
+ (0, _util.transpose)(lists.gun_violence_by_month.lines).forEach(function (row, i) {
+ var name = lists.gun_violence_by_month.h[i];
+ if (name === 'date') return;
+ console.log(name, row);
+ datasets[name] = {
+ name: name,
+ h: [name],
+ lines: [row.map(function (n) {
+ return parseInt(n);
+ })]
+ };
+ });
+ (0, _util.requestAudioContext)(ready);
});
//
@@ -40591,7 +40605,7 @@ function play_next() {
/* bind selects */
function pick_dataset(key) {
- console.log('pick dataset:', key);
+ console.log('pick dataset:', key, datasets[key]);
i = 0;
dataset = datasets[key];
bounds = (0, _util.get_bounds)(dataset);
@@ -40611,10 +40625,13 @@ function ready() {
_scales2.default.build_options(document.querySelector('#scale'));
(0, _ui.build_options)(document.querySelector('#dataset'), datasets, pick_dataset);
(0, _ui.build_options)(document.querySelector('#behavior'), behaviors, pick_behavior);
- // nx.colorize('#f4d142')
+
+ console.log(_nexusui2.default);
+ var dial_size = [50, 50];
_tone2.default.Transport.bpm.value = DEFAULT_BPM;
_ui.nx.tempo = new _nexusui2.default.Dial('#tempo', {
+ size: dial_size,
min: 10,
max: 300,
step: 1,
@@ -40632,6 +40649,7 @@ function ready() {
(0, _ui.update_radio_value_on_change)(_ui.nx.timing, '#timing', _midi.note_values);
_ui.nx.duration = new _nexusui2.default.Dial('#duration', {
+ size: dial_size,
min: 0,
max: 2,
step: 0.01,
@@ -40640,6 +40658,7 @@ function ready() {
(0, _ui.update_value_on_change)(_ui.nx.duration, '#duration', false);
_ui.nx.offset = new _nexusui2.default.Dial('#offset', {
+ size: dial_size,
min: -24,
max: 24,
step: 1,
@@ -40648,6 +40667,7 @@ function ready() {
(0, _ui.update_value_on_change)(_ui.nx.offset, '#offset', true);
_ui.nx.octave = new _nexusui2.default.Dial('#octave', {
+ size: dial_size,
min: -4,
max: 4,
step: 1,
@@ -40656,6 +40676,7 @@ function ready() {
(0, _ui.update_value_on_change)(_ui.nx.octave, '#octave', true);
_ui.nx.multiply = new _nexusui2.default.Dial('#multiply', {
+ size: dial_size,
min: -64,
max: 64,
step: 1,
@@ -40664,6 +40685,7 @@ function ready() {
(0, _ui.update_value_on_change)(_ui.nx.multiply, '#multiply', true);
_ui.nx.interval = new _nexusui2.default.Dial('#interval', {
+ size: dial_size,
min: -64,
max: 64,
step: 1,
@@ -40695,6 +40717,9 @@ function ready() {
});
document.querySelector('.loading').classList.remove('loading');
+
+ document.querySelector('#dataset').value = 'Surrenders';
+ pick_dataset('Surrenders');
play_next();
}
@@ -40930,7 +40955,7 @@ function play(freq) {
var player = best.sample.players[best.sample.index];
player.playbackRate = freq / best.sample.root;
- console.log(player);
+ // console.log(player)
player.start();
}