The familiar 8-bit sounding Ditty EXTENDED!
A fork from my first Mario Bros.
Improved synthesiser and added (with some modifications) complete OST from musescore.com/user/33605901/scores/6642763
6 jan 2023: clamped values to 8 bits
Log in to post a comment.
// Forked from "Mario Bros." by Jurgen // https://dittytoy.net/ditty/a3f838acb8 input.choose = 0; //min=0, max=0, step=1 (When you change option below it will start playing after the end of the currently playing track) input.track = 0; //min=0, max=14, step=1 (Overworld theme, Underworld theme, Underwater theme, Castle theme, Invincible, Into the pipe, You died!, Game over, Course clear, Castle Clear, Hurry!, Coin, 1-UP, Pause menu, Ending) input.bits = 8; //min=1, max=64, step=1 const WAVEFORM = {SINE: 1, SQUARE: 2, TRIANGLE: 3, SAW: 4, SEMICIRCLE: 5, SHARK_FIN: 6, SURF: 7 }; const basicSynth = synth.def(class { process(note, env, tick, options) { const value = (hz) => { const inversionMultiplier = options.inverted? -1: 1; const phase = ditty.time * hz; const f = phase * Math.PI * 2; switch(options.waveForm) { case WAVEFORM.SQUARE: return (Math.sin(f) > 0? 1: -1); case WAVEFORM.TRIANGLE: return (Math.abs((phase % 1) * 4 - 2) - 1); case WAVEFORM.SAW: return ((phase % 1) * (inversionMultiplier*2) - inversionMultiplier); case WAVEFORM.SEMICIRCLE: return (options.inverted?(Math.cos(f) < 0? 1: -1):0) + Math.sqrt(1 - ((2 * Math.asin(Math.sin(f))) / Math.PI)**2) * (Math.cos(f) < 0? -1: 1); case WAVEFORM.SHARK_FIN: return inversionMultiplier * Math.sin(f) > 0? Math.sqrt(1 - ((2 * Math.asin(Math.sin(f/2))) / Math.PI)**2) : -Math.sqrt(1 - ((2 * Math.asin(Math.sin((f+Math.PI)/2))) / Math.PI)**2); case WAVEFORM.SURF: return inversionMultiplier * Math.sin(f) > 0? 2 * Math.sqrt(1 - ((2 * Math.asin(Math.sin(f/2))) / Math.PI)**2) - 1 : -2 * Math.sqrt(1 - ((2 * Math.asin(Math.sin((f+Math.PI)/2))) / Math.PI)**2) + 1; case WAVEFORM.SINE: default: return Math.sin(f); } } let divisor = 0; return Array.from({length: options.overtones}).map((v, i) => value(midi_to_hz(note) * (i + 1))).reduce((p, c, i) => { const div = 1 / (1 + i*options.overtoneDecay); divisor += div; return p + (c * div); }, 0) / divisor * env.value; } }, { name: 'basicSynth++', waveForm: WAVEFORM.SQUARE, inverted: false, overtones: 1, overtoneDecay: 1, env: adsr2 }); const noise = synth.def(class { constructor(options) { this.hold = 0; this.holdReset = (options.hold / ditty.dt) | 0; } process(note, env, tick, options) { if(this.hold <= 0) { this.value = Math.random() * 2 - 1; this.hold = this.holdReset; } this.hold--; return this.value * env.value; } }, { name: 'noise', hold: 0, env: adsr2 }); //const clampNbit = filter.def((input, options) => { const values = (2**options.bits) / 2; return input.map(v => Math.round(clamp(v, -1, 1) * values) / values); }, {bits: () => input.bits}) //const toBits = clampNbit.createShared( { bits: () => input.bits } ); const toBits = filter.def((input, options) => { const values = (2**options.bits) / 2; return input.map(v => Math.round(clamp(v, -1, 1) * values) / values); }, {bits: 8}) const tracks = [{ config: { bpm: 180, name: 'Overworld theme' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[d3, .5], [d3, .5], [false, .5], [d3, .5], [false, .5], [d3, .5], [d3, 1], [g4, 1], [false, 1], [g2, 1], [false, 1]]], //8 [2, [[g3, 1], [false, .5], [d3, .5], [false, 1], [c3, 1], [false, .5], [f3, .5], [false, .5], [g3, .5], [false, .5], [gb3, .5], [f3, 1], [e3, 2/3], [c4, 2/3], [e4, 2/3], [f4, .5], [false, .5], [d4, .5], [e4, .5], [false, .5],[c4, .5], [false, .5], [a3, .5], [b3, .5], [g3, .5], [false, 1]]], //6 //40 [2, [[c3, 1], [false, .5], [g3, .5], [false, 1], [c4, 1], [f3, 1], [false, .5], [c4, .5], [c4, 1], [f3, 1], [c3, 1], [false, .5], [g3, .5], [false, 1], [g3, .5], [c4, .5], [false, .5], [f5, .5], [false, .5], [f5, .5], [f5, 1], [g3, 1], [c3, 1], [false, .5], [g3, .5], [false, 1], [c4, 1], //11 [f3, 1], [false, .5], [c4, .5], [c4, 1], [f3, 1], [c3, 1], [ab3, 1], [false, .5], [bb3, .5], [false, 1], [c4, 1], [false, .5], [g3, .5], [g3, 1], [c3, 1]]], //104 [3, [[ab2, 1], [false, .5], [eb3, .5], [false, 1], [ab3, 1], //15 [g3, 1], [false, .5], [c3, .5], [false, 1], [g2, 1]]], [1, [[d3, .5], [d3, .5], [false, .5], [d3, .5], [false, .5], [d3, .5], [d3, 1], //21 [g4, 1], [false, 1], [g2, 1], [false, 1]]], //136 [2, [[g3, 1], [false, .5], [d3, .5], [false, 1], [c3, 1], //22 [false, .5], [f3, .5], [false, .5], [g3, .5], [false, .5], [gb3, .5], [f3, 1], [e3, 2/3], [c4, 2/3], [e4, 2/3], [f4, .5], [false, .5], [d4, .5], [e4, .5], [false, .5], [c4, .5], [false, .5], [a3, .5], [b3, .5], [g3, .5], [false, 1]]], //168 [2, [[c3, 1], [false, .5], [fs3, .5], [g3, 1], [c4, 1], //27 [f3, 1], [f3, 1], [c4, .5], [c4, .5], [f3, 1], [d3, 1], [false, .5], [f3, .5], [g3, 1], [b3, 1], [g3, 1], [g3, 1], [c4, .5], [c4, .5], [g3, 1], [c3, 1], [false, .5], [fs3, .5], [g3, 1], [c4, 1], //31 [f3, 1], [f3, 1], [c4, .5], [c4, .5], [f3, 1], [g3, 1], [false, .5], [g3, .5], [g3, 2/3], [a3, 2/3], [b3, 2/3], [c4, 1], [g3, 1], [c3, 1], [false, 1]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[fs4, .5], [fs4, .5], [false, .5], [fs4, .5], [false, .5], [fs4, .5], [fs4, 1], [b4, 1], [false, 1], [g4, 1], [false, 1]]], [2, [[e4, 1], [false, .5], [c4, .5], [false, 1], [g3, 1], [false, .5], [c4, .5], [false, .5], [d4, .5], [false, .5], [db4, .5], [c4, 1], [c4, 2/3], [g4, 2/3], [b4, 2/3], [c5, .5], [false, .5], [a4, .5], [b4, .5], [false, .5], [a4, .5], [false, .5], [e4, .5], [f4, .5], [d4, .5], [false, 1]]], //6 [2, [[false, 1], [e5, .5], [eb5, .5], [d5, .5], [b4, .5], [false, .5], [c5, .5], [false, .5], [e4, .5], [f4, .5], [g4, .5], [false, .5], [c4, .5], [e4, .5], [f4, .5], [false, 1], [e5, .5], [eb5, .5], [d5, .5], [b4, .5], [false, .5], [c5, .5], [false, .5], [g5, .5], [false, .5], [g5, .5], [g5, 1], [false, 1], //11 [false, 1], [e5, .5], [eb5, .5], [d5, .5], [b4, .5], [false, .5], [c5, .5], [false, .5], [e4, .5], [f4, .5], [g4, .5], [false, .5], [c4, .5], [e4, .5], [f4, .5], [false, 1], [ab4, 1], [false, .5], [f4, .5], [false, 1], [e4, 1], [false, 3]]], [1, [[ab4, .5], [ab4, .5], [false, .5], [ab4, .5], [false, .5], [ab4, .5], [bb4, 1], //15 [g4, .5], [e4, .5], [false, .5], [e4, .5], [c4, 1], [false, 1], [ab4, .5], [ab4, .5], [false, .5], [ab4, .5], [false, .5], [ab4, .5], [bb4, .5], [g4, .5], [false, 4], [ab4, .5], [ab4, .5], [false, .5], [ab4, .5], [false, .5], [ab4, .5], [bb4, 1], //19 [g4, .5], [e4, .5], [false, .5], [e4, .5], [c4, 1], [false, 1], [fs4, .5], [fs4, .5], [false, .5], [fs4, .5], [false, .5], [fs4, .5], [fs4, 1], [b4, 1], [false, 1], [g4, 1], [false, 1]]], [2, [[e4, 1], [false, .5], [c4, .5], [false, 1], [g3, 1], //22 [false, .5], [c4, .5], [false, .5], [d4, .5], [false, .5], [db4, .5], [c4, 1], [c4, 2/3], [g4, 2/3], [b4, 2/3], [c5, .5], [false, .5], [a4, .5], [b4, .5], [false, .5], [a4, .5], [false, .5], [e4, .5], [f4, .5], [d4, .5], [false, 1]]], [2, [[c5, .5], [a4, .5], [false, .5], [e4, .5], [false, 1], [e4, 1], //27 [f4, .5], [c5, .5], [false, .5], [c5, .5], [f4, 1], [false, 1], [g4, 2/3], [f5, 2/3], [f5, 2/3], [f5, 2/3], [e5, 2/3], [d5, 2/3], [c5, .5], [a4, .5], [false, .5], [f4, .5], [e4, 1], [false, 1], [c5, .5], [a4, .5], [false, .5], [e4, .5], [false, 1], [e4, 1], //31 [f4, .5], [a4, .5], [false, .5], [a4, .5], [f4, 1], [false, 1], [g4, .5], [d5, .5], [false, .5], [d5, .5], [d5, 2/3], [c5, 2/3], [b4, 2/3], [g4, .5], [e4, .5], [false, .5], [e4, .5], [c4, 1], [false, 1]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[e5, .5], [e5, .5], [false, .5], [e5, .5], [false, .5], [c5, .5], [e5, 1], [g5, 1], [false, 3]]], [2, [[c5, 1], [false, .5], [g4, .5], [false, 1], [e4, 1], [false, .5], [a4, .5], [false, .5], [b4, .5], [false, .5], [bb4, .5], [a4, 1], [g4, 2/3], [e5, 2/3], [g5, 2/3], [a5, .5], [false, .5], [f5, .5], [g5, .5], [false, .5], [e5, .5], [false, .5], [c5, .5], [d5, .5], [b4, .5], [false, 1]]], //6 [2, [[false, 1], [g5, .5], [gb5, .5], [f5, .5], [ds5, .5], [false, .5], [e5, .5], [false, .5], [gs4, .5], [a4, .5], [c5, .5], [false, .5], [a4, .5], [c5, .5], [d5, .5], [false, 1], [g5, .5], [gb5, .5], [f5, .5], [ds5, .5], [false, .5], [e5, .5], [false, .5], [c6, .5], [false, .5], [c6, .5], [c6, 1], [false, 1], //11 [false, 1], [g5, .5], [gb5, .5], [f5, .5], [ds5, .5], [false, .5], [e5, .5], [false, .5], [gs4, .5], [a4, .5], [c5, .5], [false, .5], [a4, .5], [c5, .5], [d5, .5], [false, 1], [eb5, 1], [false, .5], [d5, .5], [false, 1], [c5, 1], [false, 3]]], [1, [[c5, .5], [c5, .5], [false, .5], [c5, .5], [false, .5], [c5, .5], [d5 ,1], //15 [e5, .5], [c5, .5], [false, .5], [a4, .5], [g4, 1], [false, 1], [c5, .5], [c5, .5], [false, .5], [c5, .5], [false, .5], [c5, .5], [d5 , .5], [e5, .5], [false, 4], [c5, .5], [c5, .5], [false, .5], [c5, .5], [false, .5], [c5, .5], [d5 ,1], //19 [e5, .5], [c5, .5], [false, .5], [a4, .5], [g4, 1], [false, 1], [e5, .5], [e5, .5], [false, .5], [e5, .5], [false, .5], [c5, .5], [e5, 1], [g5, 1], [false, 3]]], [2, [[c5, 1], [false, .5], [g4, .5], [false, 1], [e4, 1], [false, .5], [a4, .5], [false, .5], [b4, .5], [false, .5], [bb4, .5], [a4, 1], [g4, 2/3], [e5, 2/3], [g5, 2/3], [a5, .5], [false, .5], [f5, .5], [g5, .5], [false, .5], [e5, .5], [false, .5], [c5, .5], [d5, .5], [b4, .5], [false, 1]]], [2, [[e5, .5], [c5, .5], [false, .5], [g4, .5], [false, 1], [gs4, 1], //27 [a4, .5], [f5, .5], [false, .5], [f5, .5], [a4, 1], [false, 1], [b4, 2/3], [a5, 2/3], [a5, 2/3], [a5, 2/3], [g5, 2/3], [f5, 2/3], [e5, .5], [c5, .5], [false, .5], [a4, .5], [g4, 1], [false, 1], [e5, .5], [c5, .5], [false, .5], [g4, .5], [false, 1], [gs4, 1], //31 [a4, .5], [f5, .5], [false, .5], [f5, .5], [a4, 1], [false, 1], [b4, .5], [f5, .5], [false, .5], [f5, .5], [f5, 2/3], [e5, 2/3], [d5, 2/3], [c5, .5], [false, 3.5]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ //lows [1, [[c7, .125], [false, .875], [c7, .125], [false, .875], [c7, .125], [false, .375], [c7, .125], [false, 1.375], [c7, .125], [false, 1.875], [false, .5], [c7, .125], [false, .375], [c7, .125], [false, .375], [c7, .125], [false, .375]]], [48, [[false, 1], [c7, .125], [false, .5], [c7, .125], [false, .25]]], //40 [4, [[c7, .125], [false, .875], [c7, .125], [false, .875], [c7, .125], [false, .375], [c7, .125], [false, 1.375], [c7, .125], [false, 1.875], [false, .5], [c7, .125], [false, .375], [c7, .125], [false, .375], [c7, .125], [false, .375]]], [48, [[false, 1], [c7, .125], [false, .5], [c7, .125], [false, .25]]], ]}, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [1, [[d3, .5], [false, 1], [d3, .5], [false, 1], [d3, .5], [false, .5], [g4, .5], [false, 1.5], [g2, .5], [false, 1.5]]], [24, [[false, 2], [e6, .5], [false, 1.5]]], //40 [4, [[d3, .5], [false, 1], [d3, .5], [false, 1], [d3, .5], [false, .5], [g4, .5], [false, 1.5], [g2, .5], [false, 1.5]]], [24, [[false, 2], [e6, .5], [false, 1.5]]], ]}, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [1, [[false, 4], [false, 4]]], [24, [[c2, .14], [false, 3.86]]], //40 [4, [[false, 4], [false, 4]]], [24, [[c2, .14], [false, 3.86]]], ]} } }, { config: { bpm: 100, name: 'Underworld theme' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [2, [[c3, .25], [c4, .25], [a2, .25], [a3, .25], [bb2, .25], [bb3, .25], [false, 1.5]]], [1, [[f2, .25], [f3, .25], [d2, .25], [d3, .25], [eb2, .25], [eb3, .25], [false, 1.5]]], [1, [[f2, .25], [f3, .25], [d2, .25], [d3, .25], [eb2, .25], [eb3, .25], [false, 1], [e3, 1/6], [d3, 1/6], [db3, 1/6]]], [1, [[c3, .5], [eb3, .5], [d3, .5], [ab2, .5], [g2, .5], [db3, .5]]], [1, [[c3, 1/6], [gb3, 1/6], [f3, 1/6], [e3, 1/6], [bb3, 1/6], [a3, 1/6], [ab3, 1/3], [eb3, 1/3], [cb3, 1/3], [bb2, 1/3], [a2, 1/3], [ab2, 1/3]]], [1, [[false, 3]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [2, [[c4, .25], [c5, .25], [a3, .25], [a4, .25], [bb3, .25], [bb4, .25], [false, 1.5]]], [1, [[f3, .25], [f4, .25], [d3, .25], [d4, .25], [eb3, .25], [eb4, .25], [false, 1.5]]], [1, [[f3, .25], [f4, .25], [d3, .25], [d4, .25], [eb3, .25], [eb4, .25], , [false, 1], [e4, 1/6], [d4, 1/6], [db4, 1/6]]], [1, [[c4, .5], [eb4, .5], [d4, .5], [ab3, .5], [g3, .5], [db4, .5]]], [1, [[c4, 1/6], [gb4, 1/6], [f4, 1/6], [e4, 1/6], [bb4, 1/6], [a4, 1/6], [ab4, 1/3], [eb4, 1/3], [cb4, 1/3], [bb3, 1/3], [a3, 1/3], [ab3, 1/3]]], [1, [[false, 3]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [7, [[false, 3]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [7, [[false, 3]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [7, [[false, 3]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [7, [[false, 3]]], ] } } }, { config: { bpm: 222, name: 'Under water theme' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[d4, 1], [cs4, 1], [c4, 1]]], [1, [[b3, 1], [c4, 1], [cs4, 1]]], [1, [[d4, .5], [d4, .5], [d4, 1], [g3, 1]]], [1, [[g3, 3]]], //5 [1, [[c3, 1], [g3, 1], [c4, 1]]], [1, [[b2, 1], [fs3, 1], [b3, 1]]], [1, [[c3, 1], [g3, 1], [c4, 1]]], [1, [[e3, 1], [g3, 1], [c4, 1]]], //9 [1, [[c3, 1], [g3, 1], [c4, 1]]], [1, [[b2, 1], [fs3, 1], [b3, 1]]], [1, [[c3, 1], [g3, 1], [c4, 1]]], [1, [[e3, 1], [g3, 1], [c4, 1]]], //13 [1, [[d3, 1], [g3, 1], [b3, 1]]], [1, [[cs3, 1], [fs3, 1], [as3, 1]]], [1, [[d3, 1], [g3, 1], [b3, 1]]], [1, [[b2, 1], [g3, 1], [b3, 1]]], //17 [1, [[d3, 1], [g3, 1], [b3, 1]]], [1, [[b2, 1], [g3, 1], [b3, 1]]], [1, [[c3, 1], [g3, 1], [c4, 1]]], [1, [[g2, 1], [g3, 1], [c4, 1]]], //21 [1, [[c3, 1], [g3, 1], [e4, 1]]], [1, [[b2, 1], [g3, 1], [d4, 1]]], [1, [[as2, 1], [g3, 1], [cs4, 1]]], [1, [[cs3, 1], [g3, 1], [e4, 1]]], //25 [1, [[d3, 1], [a3, 1], [f4, 1]]], [1, [[db2, 1], [a3, 1], [f4, 1]]], [1, [[c3, 1], [a3, 1], [f4, 1]]], [1, [[b2, 1], [g3, 1], [f4, 1]]], //29 [1, [[c2, 1], [g3, 1], [e4, 1]]], [1, [[g2, 1], [g3, 1], [g3, 1]]], [1, [[f3, .5], [f3, .5], [f3, 1], [false, .5], [b2, .5]]], [1, [[c3, 3]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[d4, 1], [e4, 1], [fs4, 1]]], [1, [[g4, 1], [a4, 1], [bb4, 1]]], [1, [[b4, .5], [b4, .5], [b4, 1], [e4, 1]]], [1, [[f4, 2], [g4, 1]]], //5 [1, [[g4, 3]]], [1, [[fs4, 3]]], [1, [[g4, 3]]], [1, [[false, .5], [g4, .5], [a4, .5], [b4, .5], [c4, .5], [d4, .5]]], //9 [1, [[g4, 3]]], [1, [[fs4, 2], [a4, 1]]], [1, [[g4, 3]]], [1, [[false, 2.5], [g4, .5]]], //13 [1, [[f4, 3]]], [1, [[e4, 3]]], [1, [[f4, 3]]], [1, [[false, .5], [g4, .5], [a4, .5], [b4, .5], [c4, .5], [cs4, .5]]], //17 [1, [[f4, 3]]], [1, [[b3, 2], [a4, 1]]], [1, [[g4, 3]]], [1, [[false, 2.5], [g4, .5]]], //21 [1, [[e5, 3]]], [1, [[d5, 3]]], [1, [[cs5, 3]]], [1, [[g5, 1], [a5, 1], [false, .5], [g5, .5]]], //25 [1, [[d5, 3]]], [1, [[db5, 3]]], [1, [[c5, 3]]], [1, [[f5, 1], [g5, 1], [false, .5], [f5, .5]]], //29 [1, [[c5, 3]]], [1, [[f4, 1], [g4, 1], [b4, 1]]], [1, [[b4, .5], [b4, .5], [b4, 1], [false, .5], [f4, .5]]], [1, [[e4, 3]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[false, 3]]], [1, [[false, 3]]], [1, [[false, 2], [b4, 1]]], [1, [[b4, 2], [false, 1]]], //5 [1, [[e5, 3]]], [1, [[ds5, 3]]], [1, [[e5, 3]]], [1, [[false, 3]]], //9 [1, [[e5, 3]]], [1, [[ds5, 2], [f5, 1]]], [1, [[e5, 3]]], [1, [[false, 3]]], //13 [1, [[d5, 3]]], [1, [[cs5, 3]]], [1, [[d5, 3]]], [1, [[false, 3]]], //17 [1, [[d5, 3]]], [1, [[g4, 2], [f5, 1]]], [1, [[e5, 3]]], [1, [[false, 3]]], //21 [1, [[g5, 3]]], [1, [[g5, 3]]], [1, [[g5, 3]]], [1, [[false, 3]]], //25 [1, [[f5, 3]]], [1, [[f5, 3]]], [1, [[f5, 3]]], [1, [[false, 3]]], //29 [1, [[e5, 3]]], [1, [[a4, 1], [b4, 1], [f5, 1]]], [1, [[e5, .5], [e5, .5], [e5, 1], [false, .5], [b4, .5]]], [1, [[c5, 3]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [16, [ [false, 1], [c7, .125], [false, .875], [false, 1], [false, 1], [c7, .125], [false, .375], [c7, .125], [false, 1.375], ]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [32, [[false, 2], [d3, .5], [false, .5]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [32, [[false, 3]]], ] } } }, { config: { bpm: 180, name: 'Castle theme' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[e3, 4]]], [1, [[d3, 2], [gb3, 2]]], [1, [[f3, 4]]], [1, [[e3, 2], [ab3, 2]]], [1, [[a3, 2], [e3, 2]]], [1, [[ds3, 2], [e3, 2]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [2, [[g4, .25], [bb4, .25], [g4, .25], [a4, .25], [g4, .25], [ab4, .25], [g4, .25], [a4, .25], [g4, .25], [bb4, .25], [g4, .25], [cb5, .25], [g4, .25], [bb4, .25], [g4, .25], [a4, .25]]], [2, [[gb4, .25], [a4, .25], [gb4, .25], [ab4, .25], [gb4, .25], [a4, .25], [gb4, .25], [bb4, .25], [gb4, .25], [a4, .25], [gb4, .25], [bb4, .25], [gb4, .25], [a4, .25], [gb4, .25], [ab4, .25]]], [2, [[bb4, .25], [d5, .25], [bb4, .25], [ds5, .25], [bb4, .25], [d5, .25], [bb4, .25], [cs5, .25], [bb4, .25], [d5, .25], [bb4, .25], [cs5, .25], [bb4, .25], [c5, .25], [bb4, .25], [cs5, .25]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [2, [[false, .25], [d5, .25], [false, .25], [cs5, .25], [false, .25], [c5, .25], [false, .25], [cs5, .25], [false, .25], [d5, .25], [false, .25], [eb5, .25], [false, .25], [d5, .25], [false, .25], [cs5, .25]]], [2, [[false, .25], [cs5, .25], [false, .25], [c5, .25], [false, .25], [cs5, .25], [false, .25], [d5, .25], [false, .25], [cs5, .25], [false, .25], [d5, .25], [false, .25], [cs5, .25], [false, .25], [c5, .25]]], [2, [[false, .25], [f5, .25], [false, .25], [fs5, .25], [false, .25], [f5, .25], [false, .25], [e5, .25], [false, .25], [f5, .25], [false, .25], [e5, .25], [false, .25], [eb5, .25], [false, .25], [e5, .25]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [6, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [6, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [6, [[false, 4]]], ] } } }, { config: { bpm: 150, name: 'Invincible' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [3, [[d3, .5], [false, .5], [a3, .5], [false, .25], [d4, .25], [false, 1], [a3, .5], [d4, .5], [c3, .5], [false, .5], [g3, .5], [false, .25], [c4, .25], [false, 1], [g3, .5], [c4, .5]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [3, [[f4, .5], [f4, .5], [f4, .5], [d4, .25], [f4, .25], [false, .25], [f4, .25], [false, .25], [d4, .25], [f4, .25], [d4, .25], [f4, .5], [e4, .5], [e4, .5], [e4, .5], [c4, .25], [e4, .25], [false, .25], [e4, .25], [false, .25], [c4, .25], [e4, .25], [e4, .25], [e4, .5]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [3, [[c5, .5], [c5, .5], [c5, .5], [false, .25], [c5, .25], [false, 1], [c5, .25], [false, .25], [c5, .5], [b4, .5], [b4, .5], [b4, .5], [false, .25], [b4, .25], [false, 1], [b4, .25], [false, .25], [b4, .5]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [24, [[false, .5], [c7, .0625], [false, .25], [c7, .0625], [false, .125]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [12, [[false, 1], [e6, .25], [false, .75]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [12, [[c2, .07], [false, 1.93]]], ] } } }, { config: { bpm: 180, name: 'Into the pipe' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[d3, .5], [d3, .5], [false, .5], [d3, .5], [false, .5], [d3, .5], [d3, 1]]], [1, [[g3, 1], [false, 1], [g2, 1], [false, 1]]], [1, [[false, 1/12], [a3, 1/6], [e3, 1/6], [a2, 1/6], [false, .5], [a3, 1/6], [e3, 1/6], [a2, 1/6], [false, .5], [a3, 1/6], [e3, 1/6], [a2, 1/6], [false, 1.5 - 1/12]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[fs4, .5], [fs4, .5], [false, .5], [fs4, .5], [false, .5], [fs4, .5], [fs4, 1]]], [1, [[b4, 1], [false, 1], [g4, 1], [false, 1]]], [1, [[false, 1/18], [a4, 1/6], [e4, 1/6], [a3, 1/6], [false, .5], [a4, 1/6], [e4, 1/6], [a3, 1/6], [false, .5], [a4, 1/6], [e4, 1/6], [a3, 1/6], [false, 1.5 - 1/18]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[e5, .5], [e5, .5], [false, .5], [e5, .5], [false, .5], [c5, .5], [e5, 1]]], [1, [[g5, 1], [false, 3]]], [1, [[a5, 1/6], [e5, 1/6], [a4, 1/6], [false, .5], [a5, 1/6], [e5, 1/6], [a4, 1/6], [false, .5], [a5, 1/6], [e5, 1/6], [a4, 1/6], [false, 1.5]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [3, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [3, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [3, [[false, 4]]], ] } } }, { config: { bpm: 180, name: 'You died!' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[g3, 1], [false, .5], [g3, .5], [g3, 2/3], [a3, 2/3], [b3, 2/3]]], [1, [[c4, 1], [g3, 1], [c3, 1], [false, 1]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[g4, .5], [d5, .5], [false, .5], [d5, .5], [d5, 2/3], [c5, 2/3], [b4, 2/3]]], [1, [[g4, .5], [e4, .5], [false, .5], [e4, .5], [c4, 1], [false, 1]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[b4, .5], [f5, .5], [false, .5], [f5, .5], [f5, 2/3], [e5, 2/3], [d5, 2/3]]], [1, [[c5, .5], [false, 3.5]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [2, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [2, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [2, [[false, 4]]], ] } } }, { config: { bpm: 180, name: 'Game over' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[g3, 1], [false, .5], [e3, .5], [false, 1], [c3, 1]]], [1, [[f3, 2], [db3, 2]]], [1, [[c3, 2], [false, 2]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[e4, 1], [false, .5], [c4, .5], [false, 1], [g3, 1]]], [1, [[f4, 2], [f4, 2]]], [1, [[e4, 1/3], [d4, 1/3], [e4, 4/3], [false, 2]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[c5, 1], [false, .5], [g4, .5], [false, 1], [e4, 1]]], [1, [[a4, 2/3], [b4, 2/3], [a4, 2/3], [ab4, 2/3], [bb4, 2/3], [ab4, 2/3]]], [1, [[g4, 2], [false, 2]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [3, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [3, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [3, [[false, 4]]], ] } } }, { config: { bpm: 140, name: 'Course clear' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[false, 4]]], [1, [[false, 1], [c3, 1/3], [e3, 1/3], [g3, 1/3], [e4, 1], [c4, 1]]], [1, [[false, 1], [c3, 1/3], [eb3, 1/3], [ab3, 1/3], [eb4, 1], [c4, 1]]], [1, [[false, 1], [d3, 1/3], [f3, 1/3], [bb3, 1/3], [f4, 1], [e4, 1/3], [e4, 1/3], [e4, 1/3]]], [1, [[c4, 2], [false, 2]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[false, 4]]], [1, [[false, 1/3], [e3, 1/3], [g3, 1/3], [c4, 1/3], [e4, 1/3], [g4, 1/3], [c5, 1], [g4, 1]]], [1, [[false, 1/3], [eb3, 1/3], [ab3, 1/3], [c4, 1/3], [eb4, 1/3], [ab4, 1/3], [c5, 1], [ab4, 1]]], [1, [[false, 1/3], [f3, 1/3], [ab3, 1/3], [d4, 1/3], [f4, 1/3], [bb4, 1/3], [d5, 1], [d5, 1/3], [d5, 1/3], [d5, 1/3]]], [1, [[e5, 2], [false, 2]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[g3, 3/22], [a3, 3/22], [b3, 3/22], [c4, 3/22], [d4, 3/22], [e4, 3/22], [f4, 3/22], [g4, 3/22], [a4, 3/22], [b4, 3/22], [c5, 3/22], [d5, 3/22], [e5, 3/22], [f5, 3/22], [g5, 3/22], [a5, 3/22], [b5, 3/22], [c6, 3/22], [d6, 3/22], [e6, 3/22], [f6, 3/22], [g6, 3/22], [false, 1]]], [1, [[g3, 1/3], [c4, 1/3], [e4, 1/3], [g4, 1/3], [c5, 1/3], [e5, 1/3], [g5, 1], [e5, 1]]], [1, [[ab3, 1/3], [c4, 1/3], [eb4, 1/3], [ab4, 1/3], [c5, 1/3], [eb5, 1/3], [ab5, 1], [eb5, 1]]], [1, [[bb3, 1/3], [d4, 1/3], [f4, 1/3], [bb4, 1/3], [d5, 1/3], [f5, 1/3], [bb5, 1], [bb5, 1/3], [bb5, 1/3], [bb5, 1/3]]], [1, [[c6, 2], [false, 2]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [5, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [5, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [5, [[false, 4]]], ] } } }, { config: { bpm: 120, name: 'Castle clear' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[c3, 7/3], [c3, 1/6], [c3, 1/6], [c3,1/3], [c3,1/3], [c3,1/3], [c3,1/3]]], [1, [[db3, 7/3], [db3, 1/6], [db3, 1/6], [db3,1/3], [db3,1/3], [db3,1/3], [db3,1/3]]], [1, [[bb3, 1/3], [g3, 1/3], [eb3, 1/3], [bb3, 1/3], [g3, 1/3], [eb3, 1/3], [bb3, 1/3], [bb3, 1/6], [bb3, 1/6], [bb3, 1/3], [c4, 1/3], [c4, 1/3], [c4, 1/3]]], [1, [[d4, 2], [false, 2]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[e4, 1/3], [c4, 1/3], [g3, 1/3], [e4, 1/3], [c4, 1/3], [g3, 1/3], [e4, 1/3], [e4, 1/6], [e4, 1/6], [e4, 1/3], [e4, 1/3], [e4, 1/3], [e4, 1/3]]], [1, [[f4, 1/3], [db4, 1/3], [ab3, 1/3], [f4, 1/3], [db4, 1/3], [ab3, 1/3], [f4, 1/3], [f4, 1/6], [f4, 1/6], [f4, 1/3], [f4, 1/3], [f4, 1/3], [f4, 1/3]]], [1, [[g4, 1/3], [eb4, 1/3], [bb3, 1/3], [g4, 1/3], [eb4, 1/3], [bb3, 1/3], [g4, 1/3], [g4, 1/6], [g4, 1/6], [g4, 1/3], [a4, 1/3], [a4, 1/3], [a4, 1/3]]], [1, [[b4, 2], [false, 2]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[c5, 1/3], [g4, 1/3], [e4, 1/3], [c5, 1/3], [g4, 1/3], [e4, 1/3], [c5, 1/3], [c5, 1/6], [c5, 1/6], [c5, 1/3], [c5, 1/3], [c5, 1/3], [c5, 1/3]]], [1, [[db5, 1/3], [ab4, 1/3], [f4, 1/3], [db5, 1/3], [ab4, 1/3], [f4, 1/3], [db5, 1/3], [db5, 1/6], [db5, 1/6], [db5, 1/3], [db5, 1/3], [db5, 1/3], [db5, 1/3]]], [1, [[eb5, 1/3], [bb4, 1/3], [g4, 1/3], [eb5, 1/3], [bb4, 1/3], [g4, 1/3], [eb5, 1/3], [eb5, 1/6], [eb5, 1/6], [eb5, 1/3], [f5, 1/3], [f5, 1/3], [f5, 1/3]]], [1, [[g5, 2], [false, 2]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [4, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [4, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [4, [[false, 4]]], ] } } }, { config: { bpm: 260, name: 'Hurry!' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[e3, .5]]], [1, [[gs4, .5], [false, .5], [gs4, .5], [gs4, .5], [false, .5], [f3, .5]]], [1, [[a4, .5], [false, .5], [a4, .5], [a4, .5], [false, .5], [fs3, .5]]], [1, [[as4, .5], [false, .5], [as4, .5], [as4, .5], [false, .5], [g3, .5]]], [1, [[false, .5], [g3, 2.5]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[b3, .5]]], [1, [[b4, .5], [false, .5], [b4, .5], [b4, .5], [false, .5], [c4, .5]]], [1, [[c5, .5], [false, .5], [c5, .5], [c5, .5], [false, .5], [cs4, .5]]], [1, [[cs5, .5], [false, .5], [cs5, .5], [cs5, .5], [false, .5], [b4, .5]]], [1, [[false, .5], [b4, 2.5]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[e4, .5]]], [1, [[d5, .5], [false, .5], [d5, .5], [d5, .5], [false, .5], [f4, .5]]], [1, [[eb5, .5], [false, .5], [eb5, .5], [eb5, .5], [false, .5], [fs4, .5]]], [1, [[e5, .5], [false, .5], [e5, .5], [e5, .5], [false, .5], [f5, .5]]], [1, [[false, .5], [f5, 2.5]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [1, [[false, 12.5]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [1, [[false, 12.5]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [1, [[false, 12.5]]], ] } } }, { config: { bpm: 200, name: 'Coin' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[false, 4]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[false, 4]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[b5, 1/8], [e6, 4 - (1/8)]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [1, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [1, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [1, [[false, 4]]], ] } } }, { config: { bpm: 225, name: '1-UP' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[false, 4]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[e5, .5], [g5, .5], [e6, .5], [c6, .5], [d6, .5], [g6, .5], [false, 1]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[false, 4]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [1, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [1, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [1, [[false, 4]]], ] } } }, { config: { bpm: 600, name: 'Pause menu' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [4, [[false, 4]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [4, [[e6, .5], [c6, .5], [e6, .5], [c6, 2.5]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [4, [[false, 4]]], ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [4, [[false, 4]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [4, [[false, 4]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [4, [[false, 4]]], ] } } }, { config: { bpm: 150, name: 'Ending' }, leftHand: { one: { config: { synth: basicSynth, amp: 1, playConfig: {attack: 0, waveForm: () => WAVEFORM.TRIANGLE } }, score: [ //lows [1, [[b2, 1]]], [1, [ [c3, 2], [d3, 1], [ds3, 1], [e3, 1], [c3, 1], [a3, 1], [g3, 1], [f3, 1], [e3, 1], [d3, 1], [f3, 1], ]], [1, [[g3, 1], [g2, 1], [c3, 1], [b2, 1]]], [1, [ [c3, 2], [d3, 1], [ds3, 1], [e3, 1], [c3, 1], [a3, 1], [g3, 1], [f3, 1], [e3, 1], [d3, 1], [f3, 1], ]], [1, [[g3, 4]]], [1, [[g2, 4]]], [1, [[c3, 4]]], ] } }, rightHand: { one: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //lows [1, [[g4, 1/3], [fs4, 1/3], [g4, 1/3]]], [1, [ [g3, 2], [a3, 1], [as3, 1], [b3, 2], [e4, 1], [g4, 2/3], [g4, 1/3], [f4, 1], [g4, 1], [a4, 1], [d4, 1], ]], [1, [[f4, 2], [e4, 1], [g3, 1/3], [fs4, 1/3], [g3, 1/3]]], [1, [ [g3, 2], [a3, 1], [as3, 1], [b3, 2], [e4, 1], [g4, 2/3], [g4, 1/3], [f4, 1], [g4, 1], [a4, 1], [d4, 1], ]], [1, [[f4, 4]]], [1, [[d4, 4]]], [1, [[c4, 4]]], ] }, two: { config: { synth: basicSynth, amp: .5, playConfig: {attack: 0, waveForm: () => WAVEFORM.SQUARE } }, score: [ //highs [1, [[false, 1]]], [1, [ [e4, 2], [f4, 1], [fs4, 1], [g4, 2], [c5, 1], [e5, 2/3], [e5, 1/3], [d5, 1], [e5, 1], [f5, 1], [b4, 1], ]], [1, [[d5, 2], [c5, 1], [false, 1]]], [1, [ [e4, 2], [f4, 1], [fs4, 1], [g4, 2], [c5, 1], [e5, 2/3], [e5, 1/3], [d5, 1], [e5, 1], [f5, 1], [b4, 1], ]], [1, [[d5, 4]]], [1, [[f4, 4]]], [1, [[e4, 4]]], // there should actually be a d4 and an g4 in Arpeggio with finger 1 and 2, but that'd mean adding finger 3 and 4 to all other track as well... ] } }, drum: { hihat: { config: { synth: noise, amp: .7, playConfig: {attack: 0 } }, score: [ [1, [[false, 41]]], ] }, snare: { config: { synth: noise, amp: .5, playConfig: {attack: 0 } }, score: [ [1, [[false, 41]]], ] }, kick: { config: { synth: noise, amp: .8, playConfig: { attack: 0, hold: .0005 } }, score: [ [1, [[false, 41]]], ] } } }]; let skip = 0; Object.keys(tracks[input.track]).forEach(hand => Object.keys(tracks[input.track][hand]).forEach(finger => { if(hand == 'config') return; loop( () => { ditty.bpm = tracks[input.track].config.bpm; debug.warn('Playing', tracks[input.track].config.name + ' at ' + ditty.bpm + ' bpm'); tracks[input.track][hand][finger].score.forEach(noteSet => { for(let i = 0; i < noteSet[0]; i++) { noteSet[1].forEach(note => play(tracks[input.track][hand][finger].config.synth, tracks[input.track][hand][finger].config.playConfig, ...note)); } }); sleep(1); input.track = (input.track + 1) % tracks.length; }, { amp: tracks[input.track][hand][finger].config.amp, name: hand+'_'+finger }).connect(toBits.create({bits: () => input.bits})); }) ); const play = (synth, config, note, length) => { if(skip > .0001) { skip -= length; return; } if(note !== false) synth.play(note, { ...config, release: length - config.attack }); sleep(length); }