# Original soundtrack for the clip, synthesized from scratch (no samples): python synth.py out.wav import math, random, struct, sys, wave SR, DUR = 44100, 24.0 N = int(SR * DUR) buf = [0.0] * N rng = random.Random(7) def add(start, length, fn): a = int(start * SR) for i in range(max(0, a), min(N, a + int(length * SR))): buf[i] += fn((i - a) / SR) def note_hz(n): # semitones from A4 return 440 * 2 ** (n / 12) def chime(start, n, vol=0.22, decay=0.7): f = note_hz(n) add(start, decay * 4, lambda x: vol * math.exp(-x / decay) * (math.sin(2 * math.pi * f * x) + 0.3 * math.sin(4 * math.pi * f * x)) * min(1, x / 0.004)) def pad(start, length, notes, vol=0.05): fs = [note_hz(n) for n in notes] add(start, length, lambda x: vol * min(1, x / 0.6, (length - x) / 0.4) * sum(math.sin(2 * math.pi * f * x) for f in fs)) def noise(start, length, vol, env, lp=0.0): a = int(start * SR); y = 0.0 for i in range(max(0, a), min(N, a + int(length * SR))): x = (i - a) / SR y = lp * y + (1 - lp) * rng.uniform(-1, 1) buf[i] += vol * env(x) * y def thump(start, f0=70, vol=0.6, decay=0.25): add(start, decay * 4, lambda x: vol * math.exp(-x / decay) * math.sin(2 * math.pi * (f0 * x - 20 * x * x))) # C major pentatonic, semitones from A4: C5=3 D5=5 E5=7 G5=10 A5=12, C6=15 mel = [3, 7, 10, 12, 10, 7, 5, 7, 3, 7, 10, 15, 12, 10, 7, 10] step = 0.3 t = 0.0; k = 0 while t < 14.4: chime(t, mel[k % len(mel)]) t += step; k += 1 for s, ch in [(0, [-21, -14, -9]), (3.6, [-16, -9, -5]), (7.2, [-19, -12, -7]), (10.8, [-14, -9, -2])]: pad(s, min(3.6, 14.55 - s), ch) # heart pop and photo shutters add(3.3, 0.14, lambda x: 0.3 * math.sin(2 * math.pi * (400 * x + 3000 * x * x)) * (1 - x / 0.14)) for s in [6.0, 7.6, 9.2, 10.8, 12.4]: noise(s - 0.02, 0.07, 0.35, lambda x: math.exp(-x / 0.015)) # electromagnet hum, the clank, the crane driving off def hum(x): f = 110 + 25 * min(x, 0.4) v = math.sin(2 * math.pi * f * x) return 0.16 * (1 if v > 0 else -1) * (0.7 + 0.3 * math.sin(2 * math.pi * 30 * x)) * min(1, x / 0.05, (1.95 - x) / 0.8) add(14.55, 1.95, hum) for f, v in [(523, 0.25), (1187, 0.18), (1873, 0.12), (2711, 0.08)]: add(15.08, 1.2, lambda x, f=f, v=v: v * math.exp(-x / 0.35) * math.sin(2 * math.pi * f * x)) noise(15.08, 0.05, 0.4, lambda x: 1 - x / 0.05) noise(16.2, 0.8, 0.12, lambda x: math.sin(math.pi * x / 0.8), lp=0.9) # upcycler: sparkly float down, whirring machine with beeps and boops, then a DING noise(17.0, 0.75, 0.12, lambda x: math.sin(math.pi * x / 0.75), lp=0.9) for j in range(8): chime(17.0 + j * 0.09, 27 + [0, 2, 4, 7, 9][j % 5], vol=0.07, decay=0.25) add(17.6, 1.0, lambda x: 0.07 * math.sin(2 * math.pi * (180 + 60 * math.sin(2 * math.pi * 6 * x)) * x) * min(1, x / 0.1, (1.0 - x) / 0.1)) for j in range(4): f = 880 if j % 2 == 0 else 660 add(17.6 + j * 0.25, 0.1, lambda x, f=f: 0.12 * math.sin(2 * math.pi * f * x) * (1 - x / 0.1)) for n, v in [(27, 0.25), (31, 0.15), (34, 0.1)]: chime(18.6, n, vol=v, decay=0.8) for j in range(6): chime(18.65 + j * 0.06, 34 + [0, 3, 5, 7, 10, 12][j], vol=0.06, decay=0.3) noise(19.4, 0.2, 0.15, lambda x: math.sin(math.pi * x / 0.2), lp=0.6) # ending: gentle chimes, warm chord, a sparkle under the caption end = [15, 12, 10, 7, 10, 12, 15, 19] for j, n in enumerate(end): chime(19.6 + j * 0.42, n - 12 if j % 2 else n, vol=0.2, decay=0.9) pad(19.6, 4.4, [-21, -14, -9, -5], vol=0.06) for j, n in enumerate([27, 31, 34]): chime(20.8 + j * 0.07, n, vol=0.1, decay=0.5) chime(23.0, 3, vol=0.18, decay=1.2); chime(23.0, 7, vol=0.12, decay=1.2); chime(23.0, 10, vol=0.12, decay=1.2) peak = max(abs(v) for v in buf) or 1 fade = int(0.3 * SR) with wave.open(sys.argv[1], "wb") as w: w.setnchannels(1); w.setsampwidth(2); w.setframerate(SR) w.writeframes(b"".join(struct.pack("