Files
closed_loop_audio_test_suite/QUICKSTART.md
2026-03-23 13:52:27 +01:00

111 lines
2.6 KiB
Markdown

# Quick Start Guide
## Installation
```bash
# Install dependencies
pip install -r requirements.txt
```
## Basic Usage
### 1. Run Your First Test
```bash
python test_latency.py \
--serial-number "SN001234" \
--software-version "initial" \
--comment "First test run"
```
**What happens:**
- Auto-detects your Scarlett audio interface
- Plays chirp signal and measures latency (5 measurements by default)
- Records input/output on both channels
- Calculates average, min, max, and standard deviation of latency
- Saves results to `test_results/YYYYMMDD_HHMMSS_latency/YYYYMMDD_HHMMSS_latency_results.yaml`
### 2. View Results
```bash
# List all test results
python view_results.py --list
# View specific test (example)
python view_results.py test_results/20260226_123456_results.yaml
# View example result
python view_results.py example_test_result.yaml
```
### 3. Compare Different Units
Run multiple tests with different metadata:
```bash
# Test unit SN001234
python test_latency.py --serial-number "SN001234" --software-version "abc123"
# Test unit SN001235 with more measurements
python test_latency.py --serial-number "SN001235" --software-version "abc123" --measurements 10
# Compare by viewing both YAML files
python view_results.py test_results/20260226_120000_latency/20260226_120000_latency_results.yaml
python view_results.py test_results/20260226_130000_latency/20260226_130000_latency_results.yaml
```
## Understanding the Output
Each latency test produces:
- **Average Latency (ms)**: Mean delay across all measurements
- **Min/Max Latency (ms)**: Range of measured values
- **Standard Deviation (ms)**: Consistency of measurements (lower is better)
**Good values:**
- Latency: Depends on your system (audio interface typically < 10ms)
- Standard Deviation: < 1ms (consistent measurements)
- Latency: < 5 ms for loopback
## Configuration
Edit `config.yaml` to customize test parameters:
```yaml
audio:
sample_rate: 44100
channels: 2
device_name: "Scarlett"
output:
results_dir: "test_results"
save_plots: true
```
```bash
python -c "import sounddevice as sd; print(sd.query_devices())"
```
Update `device_name` in `config.yaml` to match your device.
## Troubleshooting
**Audio device not found:**
```bash
python -c "import sounddevice as sd; print(sd.query_devices())"
```
Update `device_name` in `config.yaml` to match your device.
**Permission errors:**
Make scripts executable (Linux/Mac):
```bash
chmod +x run_test.py view_results.py
```
## Next Steps
1. Run baseline tests with known-good hardware
2. Test different PCB revisions
3. Track software version changes
4. Archive YAML files for long-term tracking
5. Build comparison scripts as needed