#!/usr/bin/env python3 from pathlib import Path import argparse,json,subprocess R=Path(__file__).resolve().parent parser=argparse.ArgumentParser();parser.add_argument('names',nargs='+');args=parser.parse_args() records=[] for name in args.names: kind=name.split('-')[0] modes=['fixed','off','silence','toggle','jump','tail','all']+(['decay','damping','short'] if kind=='reverb' else ['frequency','gain','q','flat']) for rate in [44100,48000,96000,192000]: for mode in modes: seconds=30 if mode=='tail' else 4 value=subprocess.check_output(['taskset','-c','18',str(R/'build'/name/'run'),'error',mode,str(rate),str(seconds)],text=True).strip().split(',') record=dict(variant=name,mode=mode,rate=rate,seconds=seconds,relative_rms_db=float(value[3]),tail_relative_rms_db=float(value[4]),max_absolute=float(value[5]),nonfinite=int(value[6]),reference_energy=float(value[7]),error_energy=float(value[8])) if len(value)>9:record['worst_one_second_db']=float(value[9]) records.append(record) result=[r for r in records if r['variant']==name] print(json.dumps(dict(variant=name,worst_db=max(r['relative_rms_db'] for r in result),worst_tail_db=max(r['tail_relative_rms_db'] for r in result),max_absolute=max(r['max_absolute'] for r in result),nonfinite=sum(r['nonfinite'] for r in result))),flush=True) (R/('error-'+ '-'.join(args.names)+'.json')).write_text(json.dumps(records,indent=2))