"""v3 sounds (sorting machines, conveyors, halls, outdoor yard): picked ElevenLabs candidates → Assets/Audio. Run after eleven_batch_v3.sh. Uses the helpers from master.py / finalize.py. truck_horn.wav already exists, so the new double honk is written as truck_honk.wav. """ import os import numpy as np import master as M from finalize import compress, seg from master import SR def m(name): return M.mono(M.raw(name)) def oneshots(): # diverter paddle: soft pre-tick + main clack M.write("splitter_flip", M.clean(m("splitter_flip_1.wav"), start_db=-30, tail_db=-46, max_len=0.2, fout_ms=40), -4) M.write("sorter_beep", M.clean(m("sorter_beep_1.wav"), start_db=-26, tail_db=-46, max_len=0.25, fout_ms=40), -9) # pneumatic: keep the last ~0.27 s of the hiss (faded in), then the clunk + short ring push = M.fade(seg(m("sorter_push_0.wav"), 0.28, 0.80), 25, 0) M.write("sorter_push", M.clean(push, lead_ms=0, start_db=-30, tail_db=-40, max_len=0.42, fout_ms=60), -4) M.write("belt_join", M.clean(seg(m("belt_join_1.wav"), 0.095, 0.4), start_db=-26, tail_db=-50, max_len=0.2, fout_ms=40), -6) M.write("hall_unlock", M.clean(m("hall_unlock_1.wav"), start_db=-30, tail_db=-50, max_len=2.5, fout_ms=350), -2.5) # double honk from one sustained honk: short toot, then the full honk with its natural release h = M.highpass(m("truck_honk_0.wav")) a = M.fade(seg(h, 0.0, 0.2), 1, 35) b = M.fade(seg(h, 0.0, 0.47), 1, 110) honk = np.zeros(int(0.3 * SR) + len(b) + int(0.02 * SR)) honk[: len(a)] += a honk[int(0.3 * SR): int(0.3 * SR) + len(b)] += b M.write("truck_honk", honk, -9) # three full beeps (skip the clipped first partial one) M.write("forklift_beep", M.clean(seg(m("forklift_beep_0.wav"), 0.17, 1.40), start_db=-26, tail_db=-46, max_len=1.2, fout_ms=40), -9) st = [] for f in ("metal_step_1.wav", "metal_step_0.wav"): sl = M.slice_seq(m(f), max_len=0.3, min_gap=0.18, rel_db=-14) sl.sort(key=lambda p: -p[1]) st.append(sl[0][0]) for i, s in enumerate(st): M.write(f"metal_step_{i + 1}", M.clean(s, tail_db=-44, max_len=0.25, fout_ms=30), -8) def loops(): crane = M.highpass(m("crane_loop_0.wav"), 40) M.write("crane_loop", M.loop_xfade(seg(crane, 0.8, 4.2), 0.4), -12) fan = M.highpass(m("fan_loop_1.wav"), 30) # body length = 17 whoosh periods (0.18 s) so the blade rhythm keeps its phase across the wrap M.write("fan_loop", M.loop_xfade(seg(fan, 1.5, 1.5 + 3.06 + 0.4), 0.4), -12) yard = M.highpass(m("outdoor_loop_1.wav"), 25) M.write("outdoor_loop", M.loop_xfade(seg(yard, 1.0, 12.5), 1.5), -14) if __name__ == "__main__": oneshots() loops()