play
stop
// drums ------------------------------------- p1.player('hihat').start(Tone.now()); if ([0, 4, 8, 12].indexOf(idx) >= 0) p1.player('kick').start(); if ([2, 6, 10, 14].indexOf(idx) >= 0) p1.player('snare').start(); // synth ------------------------------------- const chords = [ ['C3', 'E3', 'G3'], // I ['G3', 'B3', 'D3'], // V ['A3', 'C3', 'E3'], // VI ['F3', 'A3', 'C3'], // IV ]; 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], '16n'); polySynth.triggerAttackRelease(chords[chordIndex][1], '16n', '+8n'); polySynth.triggerAttackRelease(chords[chordIndex][2], '16n', '+4n'); }