122 lines
2.7 KiB
Markdown
122 lines
2.7 KiB
Markdown
# Closed Loop Audio Test Suite
|
|
|
|
Simple Python-based testing system for PCB audio hardware validation.
|
|
|
|
## Features
|
|
|
|
- **Automated Testing**: Latency measurements with configurable iterations
|
|
- **Metadata Tracking**: Serial number, software version, timestamps, comments
|
|
- **YAML Output**: Human-readable structured results
|
|
- **Simple Workflow**: Run tests, view results, compare versions
|
|
|
|
## Quick Start
|
|
|
|
### 1. Install Dependencies
|
|
|
|
```bash
|
|
pip install -r requirements.txt
|
|
```
|
|
|
|
### 2. Run a Test
|
|
|
|
**Latency Test:**
|
|
```bash
|
|
python test_latency.py \
|
|
--serial-number "SN001234" \
|
|
--software-version "a3f2b1c" \
|
|
--comment "Replaced capacitor C5"
|
|
```
|
|
|
|
**Artifact Detection Test:**
|
|
```bash
|
|
python test_artifact_detection.py \
|
|
--serial-number "SN001234" \
|
|
--software-version "a3f2b1c" \
|
|
--comment "Baseline test"
|
|
```
|
|
|
|
### 3. View Results
|
|
|
|
```bash
|
|
# View specific test
|
|
python view_results.py test_results/20260226_123456_results.yaml
|
|
|
|
# List all tests
|
|
python view_results.py --list
|
|
|
|
# View latest test
|
|
python view_results.py test_results/*.yaml | tail -1
|
|
```
|
|
|
|
## Test Metrics
|
|
|
|
- **Latency**: Round-trip delay between input and output channels (ms)
|
|
- Average, minimum, maximum, and standard deviation across measurements
|
|
- Uses chirp signal for accurate cross-correlation measurement
|
|
|
|
## Output Format
|
|
|
|
Results are saved as YAML files in `test_results/`:
|
|
|
|
```yaml
|
|
metadata:
|
|
test_id: 20260226_123456
|
|
timestamp: '2026-02-26T12:34:56.789012'
|
|
serial_number: SN001234
|
|
software_version: a3f2b1c
|
|
comment: Replaced capacitor C5
|
|
latency_test:
|
|
avg: 2.345
|
|
min: 2.201
|
|
max: 2.489
|
|
std: 0.087
|
|
```
|
|
|
|
## Configuration
|
|
|
|
Edit `config.yaml` to customize:
|
|
- Audio device settings
|
|
- Output options
|
|
|
|
```yaml
|
|
audio:
|
|
sample_rate: 44100
|
|
channels: 2
|
|
device_name: "Scarlett"
|
|
|
|
output:
|
|
results_dir: "test_results"
|
|
save_plots: true
|
|
```
|
|
|
|
The system auto-detects Focusrite Scarlett audio interfaces.
|
|
|
|
## Hardware Setup
|
|
|
|
```
|
|
Laptop <-> Audio Interface (Scarlett) <-> DUT <-> Audio Interface (Scarlett) <-> Laptop
|
|
Output Channels 1&2 Input Channels 1&2
|
|
```
|
|
|
|
## File Structure
|
|
|
|
```
|
|
closed_loop_audio_test_suite/
|
|
├── config.yaml # Test configuration
|
|
├── test_latency.py # Latency test runner
|
|
├── test_artifact_detection.py # Artifact detection test
|
|
├── view_results.py # Results viewer
|
|
├── src/
|
|
│ └── audio_tests.py # Core test functions
|
|
└── test_results/ # YAML output files
|
|
├── YYYYMMDD_HHMMSS_latency/
|
|
└── YYYYMMDD_HHMMSS_artifact_detection/
|
|
```
|
|
|
|
## Tips
|
|
|
|
- Each test run creates a timestamped YAML file
|
|
- Results are self-contained with full metadata
|
|
- Compare tests by opening multiple YAML files
|
|
- Archive old tests by moving YAML files to subdirectories
|