#!/usr/bin/env bash # bench.sh — smoke-test the acdsp CLI: synthesize a sine, push through # the chain, verify the output WAV parses and isn't silent. set -euo pipefail HERE="$(cd "$(dirname "$0")" && pwd)" BIN="$HERE/../acdsp" TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT [ -x "$BIN" ] || { echo "missing $BIN — run 'make' first"; exit 1; } # 1s of 1 kHz at -6 dBFS, stereo, 44.1 kHz — generated via ffmpeg if # available, otherwise via a tiny Node script (Node ships with macOS dev tools). IN="$TMP/in.wav" if command -v ffmpeg >/dev/null; then ffmpeg -hide_banner -loglevel error -y \ -f lavfi -i "sine=frequency=1000:duration=1:sample_rate=44100" \ -ac 2 -af "volume=-6dB" "$IN" else node -e ' const {writeFileSync} = require("fs"); const sr=44100, n=sr, ch=2, bits=16; const buf = Buffer.alloc(44 + n*ch*2); buf.write("RIFF",0); buf.writeUInt32LE(36+n*ch*2,4); buf.write("WAVE",8); buf.write("fmt ",12); buf.writeUInt32LE(16,16); buf.writeUInt16LE(1,20); buf.writeUInt16LE(ch,22); buf.writeUInt32LE(sr,24); buf.writeUInt32LE(sr*ch*2,28); buf.writeUInt16LE(ch*2,32); buf.writeUInt16LE(16,34); buf.write("data",36); buf.writeUInt32LE(n*ch*2,40); for (let i=0;i