public
Created

methodical music, a collaboration with @NHQ

  • Download Gist
methodical.js
JavaScript
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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
[
function () {
return function (t, i) {
if (t % 4 > 1) return 0;
var freq = 880;
return Math.abs(1 - t % 1.33) * Math.sin(freq * t * Math.PI);
};
},
function () {
var music = [ 1/8, 11/8, 5/8, 1/8, 7/8, 13/8, 17/8, 3/8, 5/8 ];
return function (t, i) {
var n = music[Math.floor(t % music.length)];
var freq = 440 * Math.pow(2, n / 5);
return Math.abs(1 - t % 1.33) * Math.sin(freq * t * Math.PI);
};
},
function () {
return function () { return 0 }
},
function () {
return function () { return 0 }
},
function () {
return function (t, i){
return Math.abs(1 - t % 1.33) * Math.sin(freq * t * Math.PI)
}
},
function () {
return function (t, i){
if(t % 4 > 2) return 0;
//if(t % 4 > 1) var freq = 1100
var n = Math.floor(t % 12) * 2;
var freq = freq * Math.pow(2, n/12);
return t % .33 * Math.sin(freq * t * Math.PI);
}
},
function () {
return function (t, i){
if(t % 6 > 5.5555) return 0;
var b = (5.5555 - Math.floor(t % 5.5555)) * .2;
return t % b * Math.sin(freq * t * Math.PI);
}
},
function () {
return function () { return 0 }
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.