Refactoring and minor improvents.
This commit is contained in:
@@ -12,7 +12,7 @@ pip install -r requirements.txt
|
||||
### 1. Run Your First Test
|
||||
|
||||
```bash
|
||||
python run_test.py \
|
||||
python test_latency.py \
|
||||
--serial-number "SN001234" \
|
||||
--software-version "initial" \
|
||||
--comment "First test run"
|
||||
@@ -20,10 +20,10 @@ python run_test.py \
|
||||
|
||||
**What happens:**
|
||||
- Auto-detects your Scarlett audio interface
|
||||
- Plays test tones at 7 frequencies (100 Hz to 8 kHz)
|
||||
- Plays chirp signal and measures latency (5 measurements by default)
|
||||
- Records input/output on both channels
|
||||
- Calculates latency, THD, and SNR
|
||||
- Saves results to `test_results/YYYYMMDD_HHMMSS_results.yaml`
|
||||
- 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
|
||||
|
||||
@@ -38,35 +38,33 @@ python view_results.py test_results/20260226_123456_results.yaml
|
||||
python view_results.py example_test_result.yaml
|
||||
```
|
||||
|
||||
### 3. Compare Different PCB Versions
|
||||
### 3. Compare Different Units
|
||||
|
||||
Run multiple tests with different metadata:
|
||||
|
||||
```bash
|
||||
# Test unit SN001234
|
||||
python run_test.py --serial-number "SN001234" --software-version "abc123"
|
||||
python test_latency.py --serial-number "SN001234" --software-version "abc123"
|
||||
|
||||
# Test unit SN001235
|
||||
python run_test.py --serial-number "SN001235" --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_results.yaml
|
||||
python view_results.py test_results/20260226_130000_results.yaml
|
||||
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 test produces metrics at 7 frequencies:
|
||||
Each latency test produces:
|
||||
|
||||
- **Latency (ms)**: Delay between channels (should be near 0 for loopback)
|
||||
- **THD Input (%)**: Distortion in channel 1 (lower is better)
|
||||
- **THD Output (%)**: Distortion in channel 2 (lower is better)
|
||||
- **SNR Input (dB)**: Signal quality in channel 1 (higher is better)
|
||||
- **SNR Output (dB)**: Signal quality in channel 2 (higher is better)
|
||||
- **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:**
|
||||
- THD: < 0.1% (< 0.01% is excellent)
|
||||
- SNR: > 80 dB (> 90 dB is excellent)
|
||||
- Latency: Depends on your system (audio interface typically < 10ms)
|
||||
- Standard Deviation: < 1ms (consistent measurements)
|
||||
- Latency: < 5 ms for loopback
|
||||
|
||||
## Configuration
|
||||
@@ -74,11 +72,21 @@ Each test produces metrics at 7 frequencies:
|
||||
Edit `config.yaml` to customize test parameters:
|
||||
|
||||
```yaml
|
||||
test_tones:
|
||||
frequencies: [1000] # Test only 1 kHz
|
||||
duration: 3.0 # Shorter test (3 seconds)
|
||||
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:**
|
||||
|
||||
Reference in New Issue
Block a user