These tests are designed to validate adaptive learning with real audio signals, confirm persistence through export/load, and stress input boundaries across the full expected range of outcomes.
- Core adaptation pipeline: Use real synthetic audio (harmonic + noise) to drive adaptation and verify non-trivial parameter updates.
- Persistence checks: Export the model with adaptive statistics and reload it to ensure continuity of learned state.
- Boundary sweep (-1..12): Validate adaptation-rate constraints across the full numeric range to cover edge conditions and consumer hardware variability.
Script: test_adaptive_persistence.py
- Trains on a real, generated harmonic signal.
- Adapts to a different audio signal with new spectral content.
- Asserts that the transition matrix changes (learning occurred).
- Confirms training memory is bounded by the configured limit.
- Exports and reloads the model to ensure adaptive statistics persist.
Script: test_adaptive_persistence.py
- Runs
adapt_to_audiowith adaptation_rate values in [-1, 0, 1, 2, ..., 12]. - Valid values (0, 1) complete adaptation on real audio.
- Invalid values (<0 or >1) are required to raise
ValueError.
python test_adaptive_persistence.py- Valid rates (0, 1) adapt without errors and update adaptive statistics.
- Invalid rates (-1, 2..12) must raise
ValueError. - Adaptive statistics are preserved across export/load.
Validate that the smoothness-aware decoder produces paths that are at least as spectrally smooth as a transition-only Viterbi baseline when decoding noisy signals.
Script: test_ssgs.py (test_astar_vs_viterbi_decoding)
- Trains on a real synthetic signal with multiple frequency regimes plus noise.
- Decodes a short sequence using the smoothness-aware A* path and a transition-only Viterbi path.
- Computes spectral smoothness cost on both paths and asserts the A* path is less than or equal to Viterbi.
pytest -q test_ssgs.py::test_astar_vs_viterbi_decoding- A* decoding returns a path with spectral smoothness cost ≤ Viterbi.
- The decoder remains deterministic and reproducible for the same trained model.
Validate the LPC/HMM estimation pipeline by recovering known AR(4) coefficients from a synthetic process.
Script: test_ar_process.py (test_ar4_recovery_with_single_state)
- Generates a stable AR(4) signal with Gaussian noise.
- Trains a single-state HMM with
lpc_order=4. - Asserts the recovered LPC mean matches
-awithin ±0.05.
pytest -q test_ar_process.py- The recovered LPC mean is within ±0.05 of the ground-truth coefficients.
Ensure deterministic test signals, explicit error paths, and checkpoint validation work as intended.
Scripts: test_generative_capabilities.py, test_checkpoints.py, test_adaptive_persistence.py, test_ssgs.py, test_data_indexing.py
- All test signal generators now accept seeded RNGs.
- Each test passes a fixed seed to guarantee reproducibility.
Script: test_data_indexing.py
- Creates a model with empty LPC coefficients and asserts
initialize_hmm_parametersraises a descriptiveValueError.
Script: test_checkpoints.py
- Saves a safetensors checkpoint missing
state_covariances. - Confirms
load_checkpointrejects the file with an explicit error.
python test_data_indexing.py
python test_checkpoints.py
python test_generative_capabilities.py- Signal generation is repeatable across runs when the same seeds are used.
- Empty feature inputs fail fast with a clear error.
- Missing checkpoint tensors are rejected before model reconstruction begins.
Ensure the documentation references executable scripts and valid APIs so onboarding steps remain reliable.
- Quick Start scripts exist:
test_ssgs.py,demo_enhanced_capabilities.py,train_on_folder.py. - Checkpoint APIs are present:
save_checkpointandload_checkpointinssgs.py. - Adaptive learning API is present:
adapt_to_audioinssgs.py. - Feature indexing APIs are present:
build_feature_index,query_similar_frames, andsearch_by_feature_vectorinssgs.py. - Test scripts listed in README exist: all
test_*.pyfiles referenced by name.
python test_ssgs.py
python test_checkpoints.py- Scripts complete without import errors when dependencies are installed.
- Checkpoint and adaptive APIs execute with real signals, confirming documented behavior.