/**
* Dittytoy Track: Neon Horizons
* BPM: 124
* Mood: Modern Presets / New Tracks
* Complexity: 0.6
*/
ditty.bpm = 124;
// --- Arrangement Patterns (16 sections, each section = 1 bar / 4 beats) ---
const leadPattern = [1, 1, 1, 1, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 1, 1];
const bassPattern = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0];
const padPattern = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1];
const kickPattern = [1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0];
// --- Synth Definitions ---
// Lead Synth: Sawtooth with high filter cutoff
const leadSynth = synth.def((phase, env, tick, options) => {
const val = Math.sin(phase * 2 * Math.PI) > 0 ? 1 : -1; // Basic Sawtooth approximation via phase
const saw = (phase % 1) * 2 - 1;
// Simple Lowpass Filter approximation based on 0.8 param
return saw * env.value;
}, { attack: 0.05, release: 3.3 });
// Deep Bass: Square wave with low filter cutoff
const deepBass = synth.def((phase, env, tick, options) => {
const square = Math.sin(phase * 2 * Math.PI) > 0 ? 0.5 : -0.5;
return square * env.value;
}, { attack: 0.02, release: 0.3 });
// Atmosphere: Soft Sine Pad
const atmospherePad = synth.def((phase, env, tick, options) => {
return Math.sin(phase * 2 * Math.PI) * env.value;
}, { attack: 0.8, release: 1.5 });
// Kick Drum: Sine with pitch envelope
const kickDrum = synth.def((phase, env, tick, options) => {
const pitchEnv = Math.exp(-tick * 40);
return Math.sin(phase * 2 * Math.PI + pitchEnv * 10) * env.value;
}, { attack: 0.01, release: 0.1 });
// --- Loops ---
// Lead Loop
loop((loopCount) => {
if (leadPattern[loopCount % 16]) {
const notes = [c4, eb4, g4, f4, g4, bb4, c5, g4];
for (let i = 0; i < 8; i++) {
leadSynth.play(notes[i % notes.length], {
amp: 0.4,
cutoff: 0.8 // Filter parameter
});
sleep(0.5);
}
} else {
sleep(4); // Sleep for one bar
}
}, { name: 'lead' });
// Bass Loop
loop((loopCount) => {
if (bassPattern[loopCount % 16]) {
const bassNotes = [c2, c2, eb2, f2];
for (let i = 0; i < 4; i++) {
deepBass.play(bassNotes[i], {
amp: 0.7,
cutoff: 0.4 // Filter parameter
});
sleep(1);
}
} else {
sleep(4);
}
}, { name: 'bass' });
// Pad Loop
loop((loopCount) => {
if (padPattern[loopCount % 16]) {
// Chords: Cm, Ab, Eb, Bb
const chords = [
[c3, eb3, g3], [ab2, c3, eb3], [eb3, g3, bb3], [bb2, d3, f3]
];
const currentChord = chords[Math.floor(loopCount / 4) % 4];
currentChord.forEach(n => atmospherePad.play(n, {
amp: 0.3,
cutoff: 0.6 // Filter parameter
}));
sleep(4);
} else {
sleep(4);
}
}, { name: 'pad' });
// Kick Loop
loop((loopCount) => {
if (kickPattern[loopCount % 16]) {
// Standard 4/4 kick pattern within the active section
for (let i = 0; i < 4; i++) {
kickDrum.play(c1, {
amp: 1.0,
cutoff: 0.5 // Filter parameter
});
sleep(1);
}
} else {
sleep(4);
}
}, { name: 'kick' });