-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathutils.js
More file actions
33 lines (29 loc) · 728 Bytes
/
utils.js
File metadata and controls
33 lines (29 loc) · 728 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
"use strict";
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Iterators_and_Generators
var _ = require('underscore');
exports.cycle = function (array){
var nextIndex = 0;
return {
next: function(){
if (nextIndex == array.length){
nextIndex = 0;
}
return array[nextIndex++];
}
}
}
exports.notesOff = function (outputs){
_.each(outputs, function(output){
output.sendMessage([176, 120, 0])
});
}
exports.transposePattern = function (adjustment, pattern){
// Change the scale for the next call
if (pattern.scale){
pattern.scale = _.map(pattern.scale, function(n){
return n.interval(adjustment)
});
}
// Change all the notes in the pattern
// TODO
}