/**
* Dittytoy Track: Pentatonic Fusion
* BPM: 124
* Mood: New tracks with presets
* Complexity: 0.8
*/
ditty.bpm = 124;
// --- Arrangement Patterns (16 sections) ---
const lead1Pattern = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0];
const bass1Pattern = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0];
const pad1Pattern = [0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0];
const kick1Pattern = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1];
const kick2Pattern = [1, 0, 1, 0, 1, 1, 1, 0, 1, 0, 1, 0, 1, 0, 1, 1];
const hihatPattern = [0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0];
const pad2Pattern = [0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1];
const lead2Pattern = [1, 1, 0, 1, 1, 0, 1, 1, 1, 0, 1, 0, 0, 1, 0, 0];
const pad3Pattern = [0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0];
const lead3Pattern = [1, 1, 1, 1, 0, 1, 1, 1, 0, 0, 1, 0, 1, 0, 1, 0];
const lead4Pattern = [0, 0, 0, 1, 0, 0, 1, 0, 1, 0, 1, 0, 0, 1, 0, 1];
const bass2Pattern = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
const lead5Pattern = [0, 1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0];
// --- Scale Definition (C Pentatonic) ---
const scale = [c3, d3, e3, g3, a3, c4, d4, e4, g4, a4, c5];
// --- Synth Definitions ---
// Lead 1: Muffled Saw
const synthLead1 = synth.def((phase, env, tick, options) => {
const s = Math.sin(phase * 2 * Math.PI * (1 + Math.sin(phase * 0.01))); // Modified saw feel
const saw = (phase % 1) * 2 - 1;
return saw * env.value * options.filter;
}, { attack: 1.071, release: 3.3 });
// Bass 1: Bright Square
const synthBass1 = synth.def((phase, env, tick, options) => {
const sq = Math.sin(phase * 2 * Math.PI) > 0 ? 1 : -1;
return sq * env.value * options.filter;
}, { attack: 0.001, release: 0.1 });
// Pad 1: Sine
const synthPad1 = synth.def((phase, env, tick, options) => {
return Math.sin(phase * 2 * Math.PI) * env.value * options.filter;
}, { attack: 1.141, release: 3 });
// Kick 1: Deep Sine
const synthKick1 = synth.def((phase, env, tick, options) => {
const p = phase * (1 - tick * 2); // Pitch drop
return Math.sin(p * 2 * Math.PI) * env.value * options.filter;
}, { attack: 0.01, release: 0.1 });
// Kick 2: Snappy Sine
const synthKick2 = synth.def((phase, env, tick, options) => {
const p = phase * (1 - tick * 5);
return Math.sin(p * 2 * Math.PI) * env.value * options.filter;
}, { attack: 0.001, release: 0.15 });
// Hihat: Noise
const synthHihat = synth.def((phase, env, tick, options) => {
return (Math.random() * 2 - 1) * env.value * options.filter;
}, { attack: 0.001, release: 0.05 });
// Pad 2: Dark Square
const synthPad2 = synth.def((phase, env, tick, options) => {
const sq = Math.sin(phase * 2 * Math.PI) > 0 ? 1 : -1;
return sq * env.value * options.filter;
}, { attack: 1, release: 3.2 });
// Lead 2: Plucky Saw
const synthLead2 = synth.def((phase, env, tick, options) => {
return ((phase % 1) * 2 - 1) * env.value * options.filter;
}, { attack: 0.05, release: 0.4 });
// Pad 3: Bright Sine
const synthPad3 = synth.def((phase, env, tick, options) => {
return Math.sin(phase * 2 * Math.PI) * env.value * options.filter;
}, { attack: 1.451, release: 4 });
// Lead 3: Atmospheric Noise
const synthLead3 = synth.def((phase, env, tick, options) => {
return (Math.random() * 2 - 1) * env.value * options.filter;
}, { attack: 0.111, release: 3.95 });
// Lead 4: Swelling Square
const synthLead4 = synth.def((phase, env, tick, options) => {
const sq = Math.sin(phase * 2 * Math.PI) > 0 ? 1 : -1;
return sq * env.value * options.filter;
}, { attack: 1.991, release: 3.9 });
// Bass 2: Textural Noise
const synthBass2 = synth.def((phase, env, tick, options) => {
return (Math.random() * 2 - 1) * env.value * options.filter;
}, { attack: 0.001, release: 0.3 });
// Lead 5: Slow Saw
const synthLead5 = synth.def((phase, env, tick, options) => {
return ((phase % 1) * 2 - 1) * env.value * options.filter;
}, { attack: 1.891, release: 4 });
// --- Loops ---
loop((loopCount) => {
if (lead1Pattern[loopCount % 16]) {
synthLead1.play(scale[7], { filter: 0.08, duration: 4 });
}
sleep(4);
}, { name: 'lead1' });
loop((loopCount) => {
if (bass1Pattern[loopCount % 16]) {
for(let i=0; i<8; i++) {
synthBass1.play(scale[1] - 12, { filter: 0.87 });
sleep(0.5);
}
} else {
sleep(4);
}
}, { name: 'bass1' });
loop((loopCount) => {
if (pad1Pattern[loopCount % 16]) {
synthPad1.play(scale[4], { filter: 0.6, duration: 4 });
}
sleep(4);
}, { name: 'pad1' });
loop((loopCount) => {
if (kick1Pattern[loopCount % 16]) {
for(let i=0; i<4; i++) {
synthKick1.play(c1, { filter: 0.5 });
sleep(1);
}
} else {
sleep(4);
}
}, { name: 'kick1' });
loop((loopCount) => {
if (kick2Pattern[loopCount % 16]) {
synthKick2.play(c2, { filter: 0.8 });
sleep(2);
synthKick2.play(c2, { filter: 0.8 });
sleep(2);
} else {
sleep(4);
}
}, { name: 'kick2' });
loop((loopCount) => {
if (hihatPattern[loopCount % 16]) {
for(let i=0; i<16; i++) {
synthHihat.play(c8, { filter: 1, amp: Math.random() * 0.5 });
sleep(0.25);
}
} else {
sleep(4);
}
}, { name: 'hihat' });
loop((loopCount) => {
if (pad2Pattern[loopCount % 16]) {
synthPad2.play(scale[2], { filter: 0.08, duration: 4 });
}
sleep(4);
}, { name: 'pad2' });
loop((loopCount) => {
if (lead2Pattern[loopCount % 16]) {
for(let i=0; i<4; i++) {
synthLead2.play(scale[8], { filter: 0.8 });
sleep(1);
}
} else {
sleep(4);
}
}, { name: 'lead2' });
loop((loopCount) => {
if (pad3Pattern[loopCount % 16]) {
synthPad3.play(scale[5], { filter: 0.96, duration: 4 });
}
sleep(4);
}, { name: 'pad3' });
loop((loopCount) => {
if (lead3Pattern[loopCount % 16]) {
synthLead3.play(c6, { filter: 0.94, duration: 4 });
}
sleep(4);
}, { name: 'lead3' });
loop((loopCount) => {
if (lead4Pattern[loopCount % 16]) {
synthLead4.play(scale[6], { filter: 0.97, duration: 4 });
}
sleep(4);
}, { name: 'lead4' });
loop((loopCount) => {
if (bass2Pattern[loopCount % 16]) {
synthBass2.play(c1, { filter: 0.99, amp: 0.2 });
}
sleep(4);
}, { name: 'bass2' });
loop((loopCount) => {
if (lead5Pattern[loopCount % 16]) {
synthLead5.play(scale[9], { filter: 1, duration: 4 });
}
sleep(4);
}, { name: 'lead5' });