diff options
Diffstat (limited to 'lib/tests/test_pipeline.py')
| -rw-r--r-- | lib/tests/test_pipeline.py | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/tests/test_pipeline.py b/lib/tests/test_pipeline.py index da2e9da..b3f91f1 100644 --- a/lib/tests/test_pipeline.py +++ b/lib/tests/test_pipeline.py @@ -19,6 +19,16 @@ def test_stage_order_and_names(): assert by_name["levelling"].enabled is True +def test_denoise_stage_detail_shows_pf(): + opts = Options() + stages = pipeline.build_stages(opts) + assert "pf=off" in stages[0].detail + assert "leveling" not in stages[0].detail + opts.denoise_pf = True + stages = pipeline.build_stages(opts) + assert "pf=on" in stages[0].detail + + def test_full_chain_profile_bounds(sr): opts = Options() opts.denoise = "off" @@ -68,3 +78,37 @@ def test_podcast_profile_bounds(sr): res = pipeline.run_pipeline(x, sr, opts) assert abs(meters.lufs(res.audio, sr) + 16.0) < 0.8 assert meters.true_peak_db(res.audio, sr) <= -1.4 + + +def test_dsp_pregain_makes_chain_level_invariant(sr): + """The voice chain must treat a quiet and a hot take identically. + + Denoised files often arrive far below the chain's design level; without + the pre-gain the absolute comp thresholds would idle (or slam) depending + on input level alone. + """ + hot = Options() + hot.denoise = "off" + hot.enhance = "off" + hot.levelling = False + quiet = Options() + quiet.denoise = "off" + quiet.enhance = "off" + quiet.levelling = False + x_hot = speechish(6.0, sr, level_dbfs=-14.0) + x_quiet = speechish(6.0, sr, level_dbfs=-38.0) + y_hot = pipeline.run_pipeline(x_hot, sr, hot).audio + y_quiet = pipeline.run_pipeline(x_quiet, sr, quiet).audio + diff = abs(meters.rms_db(y_hot) - meters.rms_db(y_quiet)) + assert diff < 1.0 + + +def test_dsp_pregain_note_recorded(sr): + opts = Options() + opts.denoise = "off" + opts.enhance = "off" + notes: list[str] = [] + stages = pipeline.build_stages(opts, notes) + dsp_stage = next(s for s in stages if s.name == "dsp") + dsp_stage.fn(speechish(4.0, sr, level_dbfs=-30.0), sr) + assert any("pregain" in n for n in notes) |
