// --- Configuration Cyber-Combat 2025 (Édition Mélodique) ---
ditty.bpm = 124; // Un peu moins vite pour plus de clarté
// --- INSTRUMENTS ---
const cyberPluck = synth.def((phase, env, tick) => {
const v = (phase % 1) < 0.5 ? 1 : -1;
return Math.tanh(v * 2) * env.value;
}, { attack: 0.001, release: 0.15 });
const industrialBass = synth.def((phase, env, tick) => {
const v = (phase % 1) * 2 - 1;
const cutoff = 0.15 + Math.abs(Math.sin(tick * 0.3)) * 0.4;
return v * cutoff * env.value;
}, { attack: 0.01, release: 0.25 });
const hardKick = synth.def((phase, env, tick) => {
const p = Math.exp(-tick * 18);
return Math.sin(phase * 2 * Math.PI * (1 + p * 9)) * env.value;
}, { attack: 0.001, release: 0.35 });
const hatSynth = synth.def((phase, env) => (Math.random()*2-1) * env.value, {attack:0.001, release:0.05});
// --- SÉQUENÇAGE ---
// 1. TETRIS COMPLET & HARMONISÉ (Plus de notes)
const tetrisFull = [
e5, b4, c5, d5, c5, b4, a4, a4, c5, e5, d5, c5, b4, c5, d5, e5, c5, a4, a4, 0,
d5, f5, a5, g5, f5, e5, c5, e5, d5, c5, b4, b4, c5, d5, e5, c5, a4, a4, 0
];
loop((i) => {
const note = tetrisFull[i % tetrisFull.length];
if (note !== 0) {
// On joue la note principale
cyberPluck.play(note, { amp: 0.35 });
// On ajoute une harmonique (plus de notes !) une fois sur deux
if (i % 4 === 0) {
cyberPluck.play(note - 12, { amp: 0.15, release: 0.4 }); // Octave inférieure
}
}
sleep(0.25);
}, { name: 'tetris_rich' });
// 2. KICK ROLLING (Un peu plus spacieux)
loop((i) => {
hardKick.play(c2, { amp: 1.2 });
if (i % 2 === 1) {
sleep(0.5);
hardKick.play(c1, { amp: 0.4, attack: 0.05, release: 0.15 });
return;
}
sleep(0.5);
}, { name: 'kick' });
// 3. BASSE RICHE (Suit la mélodie)
loop((i) => {
const bassNotes = [a1, e1, a1, f1, g1, c2, e1, a1];
industrialBass.play(bassNotes[i % bassNotes.length], { amp: 0.6 });
sleep(0.5);
}, { name: 'bass_melodic' });
// 4. HI-HATS
loop((i) => {
sleep(0.5);
hatSynth.play(c4, { amp: 0.12 });
sleep(0.5);
}, { name: 'hats' });