"""Original eight-second workshop ident: relay, keyboard, CRT hum and PC chime.""" from pathlib import Path import math,random,struct,wave ROOT=Path(__file__).resolve().parents[2] def main(): rate=22050;rng=random.Random(184);data=bytearray();low=0 for i in range(rate*8): t=i/rate;noise=rng.uniform(-1,1);low=.94*low+.06*noise v=.004*math.sin(math.tau*50*t)+.002*low if t>.45: age=t-.45 v+=.055*math.exp(-age*65)*noise+.018*math.exp(-age*6)*math.sin(math.tau*(170*age+90*age*age)) for onset in [.8,1.4,2.0,2.16,3.05]: age=t-onset if 0<=age<.08:v+=.045*math.exp(-age*95)*(noise*.7+math.sin(math.tau*1400*age)*.3) for onset,hz in [(4.95,523.25),(5.15,659.25),(5.38,783.99)]: age=t-onset if age>=0:v+=.035*(1-math.exp(-age*80))*math.exp(-age*3)*math.sin(math.tau*hz*age) fade=min(1,t/.15,max(0,(8-t)/.55));v*=fade pan=.1*math.sin(t*.6) for gain in [1-pan,1+pan]:data.extend(struct.pack('