Ears for coding agents: let AI hear, review and make sound. CPU-only, open source.
doctor: the bank line leads the summary; sines.to_code writes HF = None for older models
Leonxlnx1d1ad90f4d16
diff --git a/earshot/doctor.py b/earshot/doctor.pyindex 544e5b2..e7f27f2 100644--- a/earshot/doctor.py+++ b/earshot/doctor.py@@ -164,15 +164,15 @@ def check(load=False, fetch_missing=False):_load(r)except RuntimeError as e: # a model that cannot load (offline and not cached, a damaged cache): say whyproblems.append(f'model load failed: {e}')- b = r['bank']+ b, head = r['bank'], []if not b.get('error'):ty = b['types']- notes.append(f"Sound bank {b['version']}: {b['sounds']} sounds ({ty.get('forge', 0) - b['pluck']} forge, "- f"{b['pluck']} plucks, {ty.get('fit', 0)} fitted from CC0 recordings"- + (f"; extra files from EARSHOT_BANK: {', '.join(b['extra'])}" if b['extra'] else '') + ').')+ head.append(f"Sound bank {b['version']}: {b['sounds']} sounds ({ty.get('forge', 0) - b['pluck']} forge, "+ f"{b['pluck']} plucks, {ty.get('fit', 0)} fitted from CC0 recordings"+ + (f"; extra files from EARSHOT_BANK: {', '.join(b['extra'])}" if b['extra'] else '') + ').')r['problems'], r['notes'] = problems, notes- r['summary'] = ' '.join(['earshot looks healthy.' if not problems else- 'Problems: ' + '; '.join(p.rstrip('.') for p in problems) + '.'] + notes)+ r['summary'] = ' '.join(head + ['earshot looks healthy.' if not problems else+ 'Problems: ' + '; '.join(p.rstrip('.') for p in problems) + '.'] + notes)return rdiff --git a/earshot/forge/fit/sines.py b/earshot/forge/fit/sines.pyindex d63c5dd..ea2985e 100644--- a/earshot/forge/fit/sines.py+++ b/earshot/forge/fit/sines.py@@ -1146,7 +1146,8 @@ def to_code(model, name='sound'):lines.append(f" ({tr['t']}, {_lit(tr['atoms'])}),")lines.append(']')lines.append(f"BANDS = {_lit(res['bands'])}")- lines.append(f"HF = {_lit(res.get('hf'))} # the noise above 16 kHz: the recording's roll-off [Hz, dB]")+ lines.append(f"HF = {_lit(res['hf']) if res.get('hf') else None} # the noise above 16 kHz: the recording's "+ "roll-off [Hz, dB] (None: flat, a model fitted before 0.3)")lines.append(f"TIMES = {_lit(res['times'])}")lines.append('LEVELS = [')for row in res['db']:diff --git a/tests/test_fit_takes.py b/tests/test_fit_takes.pyindex c9a2193..fcb304d 100644--- a/tests/test_fit_takes.py+++ b/tests/test_fit_takes.py@@ -102,9 +102,10 @@ def test_sines_residual_follows_the_recordings_rolloff(tone_model):y, y_flat = sines.render(m, 0), sines.render(flat, 0)assert _above_20k_db(y) < _above_20k_db(y_flat) - 10assert _above_20k_db(y) < -60- ns = {}- exec(compile(sines.to_code(m, 'tone'), 'tone.py', 'exec'), ns)- assert np.allclose(ns['render'](0), y, atol=1e-9)+ for model, ref in ((m, y), (flat, y_flat)): # the standalone script, with and without hf+ ns = {}+ exec(compile(sines.to_code(model, 'tone'), 'tone.py', 'exec'), ns)+ assert np.allclose(ns['render'](0), ref, atol=1e-9)def test_sines_take_fades_its_noise_out(tone_model):