play
stop
// drums --------------------- sampler.get("hihat").start(); if([0,1,4,8,12].indexOf(idx) >= 0) sampler.get("kick").start(); if([2,6,10,14].indexOf(idx) >= 0) sampler.get("snare").start(); // synth ----------------------- // E♭, F, G, A♭, B♭, C, D const chords = [ ['Eb2','Gb3','Bb3','D4'], //I ['C2','Eb3','G3','Bb4'], //VI ['F2','Ab3','C3','Eb4'], //II ['Bb2','D3','F3','Ab4'] // V ]; let chordIndex = -1; if(idx === 0) chordIndex = 0; if(idx === 4) chordIndex = 1; if(idx === 8) chordIndex = 2; if(idx === 12) chordIndex = 3; if(chordIndex >= 0) { polySynth.triggerAttackRelease(chords[chordIndex][0],'8n'); polySynth.triggerAttackRelease(chords[chordIndex][1],'16n', '+16n'); polySynth.triggerAttackRelease(chords[chordIndex][2],'16n', '+8n'); polySynth.triggerAttackRelease(chords[chordIndex][3],'16n', '+4n'); }