return function (t) { var notes = []; for (var i = 0; i <= 12; i ++) notes.push(2*440 * Math.pow(2,i/12)) var sequence = [0, 2, 4, 5, 7, 9, 11]; function note(x) { if (x == null) return x -= 1; return notes[sequence[(x + 7 * 1000) % 7]] * Math.pow(2, Math.floor(x / 7)) } var n var mario = [3, 3, n, 3, n, 1, 3, n, 5, n, n, n, -2, n, n, n, 1,n,n,-2,n,n,-4,n,n,-1,n,0,n,-1,-1,n,-2,3,n,5,6,n,4,5,n,3,n,1,2,0,n,n,n, 1,n,n,-2,n,n,-4,n,n,-1,n,0,n,-1,-1,n,-2,3,n,5,6,n,4,5,n,3,n,1,2,0,n,n,n, n,n,5,5,4,2,n,3,n,-2,-1,1,n,-1,1,2,n,n,5,5,4,2,n,3,n,8,n,8,8,n,n,n, n,n,5,5,4,2,n,3,n,-2,-1,1,n,-1,1,2,n,n,3,n,n,2,n,n,1,n,n,-2,-2,n,-6,n, 1,1,n,1,n,1,2,n,3,1,n,-1,-2,n,n,n, 1,1,n,1,n,1,2,n,3,n,n,n,n,n,n,n, 1,1,n,1,n,1,2,n,3,1,n,-1,-2,n,n,n] var v = 10 var index = Math.floor(t * v) % mario.length var velocity = 1 - (t * v) % 1 return sawtooth(note(mario[index])) * velocity; function sawtooth(x) { var n = x * t return 2*( Math.pow(n % 2 - 1,2)-0.5) } }
pause