# Settings
# Settings # ========================= sample_rate = 44100 # Samples per second duration = 8 # Track duration in seconds bpm = 120 beats_per_second = bpm / 60 samples_per_beat = int(sample_rate / beats_per_second) # ========================= # Kick (808-like) # ========================= def kick_wave(length, sr): t = np.linspace(0, 1, length) # Kick: exponential decay + sine kick = np.sin(2 * np.pi * 50 * t) * np.exp(-6 * t) return kick # ========================= # Hi-Hats (shuffled) # ========================= def hi_hat_wave(length, sr, swing=0.02): hh = np.zeros(length) interval = int(sr / (bpm / 60) / 4) # 16th notes for i in range(0, length, interval): # leichte Verschiebung für Shuffle shift = int(((-1)**(i//interval)) * swing * sr) idx = i + shift if idx < length: hh[idx:idx+100] += np.random.uniform(-0.3,0.3,100) # kurzer Noise-Hit return hh # ========================= # Bass / Lead Akzente (punktuell) # ========================= def bass_wave(length, sr): bass = np.zero