Repository navigation
Utility and Auxiliary Widgets
Relevant source files
The following files were used as context for generating this wiki page:
- AGENTS.md
- docs/widgets/advanced_distortion_meter.en.md
- docs/widgets/advanced_distortion_meter.md
- docs/widgets/boxcar_averager.en.md
- docs/widgets/boxcar_averager.md
- docs/widgets/hrtf_player.en.md
- docs/widgets/hrtf_player.md
- docs/widgets/linearity_analyzer.en.md
- docs/widgets/linearity_analyzer.md
- docs/widgets/recorder_player.en.md
- docs/widgets/recorder_player.md
- docs/widgets/sound_quality_analyzer.en.md
- docs/widgets/sound_quality_analyzer.md
- docs/widgets/ultrasound_modulator.en.md
- docs/widgets/ultrasound_modulator.md
- docs/widgets/waveform_loop_player.en.md
- docs/widgets/waveform_loop_player.md
- scripts/check_ui_size_limits.py
- scripts/test_lockin_dynamic_reserve.py
- src/core/bit_depth_estimator.py
- src/core/comparison_manager.py
- src/core/ltc.py
- src/core/transmission_logic.py
- src/gui/styles.py
- src/gui/widgets/loopback_finder.py
- src/gui/widgets/plot_comparer.py
- src/gui/widgets/processor_benchmark.py
- src/gui/widgets/recorder_player.py
- src/gui/widgets/sound_quality_analyzer.py
- src/gui/widgets/timecode_monitor.py
- src/gui/widgets/transmission_analyzer.py
- tests/logic_verification/analysis/test_antigravity_fixes.py
- tests/logic_verification/analysis/test_distortion_averaging.py
- tests/logic_verification/core/test_bit_depth_estimator.py
- tests/logic_verification/core/test_comparison_manager.py
- tests/logic_verification/core/test_ltc.py
- tests/logic_verification/core/test_ring_buffer.py
- tests/logic_verification/core/test_transmission.py
- tests/logic_verification/gui/test_loopback_finder.py
- tests/logic_verification/gui/test_noise_profiler_widget_logic.py
- tests/logic_verification/gui/test_plot_comparer.py
- tests/logic_verification/instruments/test_allan_worker.py
- tests/security/test_recorder_memory.py
The Utility and Auxiliary widgets in MeasureLab provide essential support functions that extend beyond standard signal analysis. These include tools for signal recording/playback, transmission path verification, system benchmarking, and specialized signal generation.
The RecorderPlayer module provides high-performance audio recording and playback with disk-streaming capabilities. It is designed to handle large files without exhausting system memory by utilizing a background writer thread and chunked I/O.
-
Disk Streaming: Unlike simple buffer-based recorders, this module uses a
_writer_threadand aqueue.Queueto stream recorded samples to a temporary file on disksrc/gui/widgets/recorder_player.py:132-136. -
Resampling: When loading files with a sample rate different from the
AudioEngine, theFileLoadWorkerperforms polyphase resampling viaAudioCalc.resamplesrc/gui/widgets/recorder_player.py:63-66. -
Safety: The
FileLoadWorkervalidates file sizes before loading to prevent OOM (Out of Memory) errorssrc/gui/widgets/recorder_player.py:49-53.
- The
AudioEnginemaster callback provides input samples. -
RecorderPlayerpushes these samples into the_write_queue. - The background thread pulls from the queue and writes to a
soundfileobjectsrc/gui/widgets/recorder_player.py:97-109.
Sources: src/gui/widgets/recorder_player.py:39-115, src/gui/widgets/recorder_player.py:116-214
The Transmission Analyzer is a sophisticated tool for validating digital and analog signal paths using Pseudo-Random Binary Sequences (PRBS). It measures Bit Error Rate (BER), Error Vector Magnitude (EVM), and impulse response.
The system uses an LFSR (Linear Feedback Shift Register) to generate standard patterns (PRBS-7 through PRBS-31) src/core/transmission_logic.py:14-58.
| Feature | Implementation |
|---|---|
| Initial Sync | Sliding Pearson correlation against a reference cycle src/core/transmission_logic.py:146-184. |
| Jitter Tracking | Neighborhood search around the last known offset to track sample slips src/core/transmission_logic.py:187-205. |
| Digital Mode | Bit-by-bit comparison to diagnose bit-perfection and active bit depth src/gui/widgets/transmission_analyzer.py:87-90. |
| Analog Mode | Fractional delay estimation and Equalized EVM to remove linear frequency response errors src/core/transmission_logic.py:240-275. |
graph TD
subgraph "TransmissionAnalyzer (Module)"
TA["TransmissionAnalyzer Class"]
RX["rx_buffer (np.ndarray)"]
GEN["generator_l/r (PRBSGenerator)"]
end
subgraph "Logic Layer (transmission_logic.py)"
FSD["find_sequence_delay()"]
TJ["track_jitter()"]
EIR["extract_impulse_response()"]
CE["calculate_evm()"]
end
TA -->|1. Sync| FSD
TA -->|2. Track| TJ
TA -->|3. Deconvolve| EIR
TA -->|4. Metric| CE
Sources: src/gui/widgets/transmission_analyzer.py:43-145, src/core/transmission_logic.py:8-205, tests/logic_verification/core/test_transmission.py:26-144
The TimecodeMonitor handles Longitudinal Timecode (LTC) encoding and decoding. It supports "Jam Syncing," where the generator can be slaved to an incoming external timecode signal.
-
Encoder: Implements Bi-phase Mark Encoding (BPM). Transitions occur at every bit boundary; a '1' bit adds a transition in the middle
src/core/ltc.py:102-157. -
Decoder: Uses zero-crossing detection and pulse-width discrimination to identify "short" vs "long" pulses, reconstructing the 80-bit LTC frame
src/core/ltc.py:160-214. -
Precision: The encoder uses a global sample accumulator (
samples_generated) to prevent drift over long durationssrc/core/ltc.py:21-23.
Sources: src/gui/widgets/timecode_monitor.py:99-210, src/core/ltc.py:10-157
This module performs offline psychoacoustic analysis based on human hearing models. It calculates metrics that correlate with subjective perception rather than just physical SPL.
-
Sharpness: Measures high-frequency content in
acumunitssrc/gui/widgets/sound_quality_analyzer.py:120-129. -
Roughness: Analyzes modulation in the 70Hz range to quantify "grating" sounds in
aspersrc/gui/widgets/sound_quality_analyzer.py:131-139. -
Tonality: Identifies pure tones against a noise floor
src/gui/widgets/sound_quality_analyzer.py:141-149. -
Articulation Index: Estimates speech intelligibility
src/gui/widgets/sound_quality_analyzer.py:162-170.
The analysis is performed by AnalysisWorker (a QThread), which resamples audio to a fixed 48kHz internal rate optimized for the psychoacoustic filters src/gui/widgets/sound_quality_analyzer.py:80-88.
Sources: src/gui/widgets/sound_quality_analyzer.py:37-180, docs/widgets/sound_quality_analyzer.md:15-20
The ProcessorBenchmark evaluates the host system's capability to handle real-time DSP at various FFT sizes and sample rates.
-
FFT Performance: Measures the execution time of
fft_manager.forward()across sizes from 4096 to 16M samplessrc/gui/widgets/processor_benchmark.py:195-200. -
UI Rendering: Benchmarks
pyqtgraphupdate speeds to ensure the display does not lag the audio processingsrc/gui/widgets/processor_benchmark.py:73-78. -
Safety Factor: Calculates the maximum sustainable FPS by comparing processing time against the hardware buffer duration
src/gui/widgets/processor_benchmark.py:126-132.
Sources: src/gui/widgets/processor_benchmark.py:68-202
The PlotComparer serves as a centralized hub for overlaying data from different modules (e.g., comparing a Spectrum Analyzer trace with a Network Analyzer sweep).
It interacts with the ComparisonManager singleton to retrieve ComparisonTrace objects src/gui/widgets/plot_comparer.py:61-62.
graph LR
subgraph "Modules"
SA["SpectrumAnalyzer"]
NA["NetworkAnalyzer"]
end
subgraph "Data Storage"
CM["ComparisonManager"]
CT["ComparisonTrace"]
end
subgraph "UI"
PCW["PlotComparerWidget"]
TW["QTreeWidget (Trace List)"]
end
SA -->|get_comparable_data| CM
NA -->|get_comparable_data| CM
CM -->|signal: trace_added| PCW
PCW -->|Populate| TW
-
Dual Y-Axis: Supports simultaneous display of different units (e.g., dB for Magnitude and Degrees for Phase) using a secondary
ViewBoxsrc/gui/widgets/plot_comparer.py:174-180. -
Trace Normalization: Allows applying
offset_dbor time-shifts to individual traces for alignmentsrc/gui/widgets/plot_comparer.py:66-68. -
Interactive Readout: A Dash-style cursor provides precise X/Y values for all visible traces
src/gui/widgets/plot_comparer.py:185-191.
Sources: src/gui/widgets/plot_comparer.py:59-200, tests/logic_verification/gui/test_plot_comparer.py:35-142
A diagnostic utility that detects physical or virtual routing paths between output and input channels.
-
Method: Sequentially outputs a 440Hz test tone on each output channel while monitoring all input channels
src/gui/widgets/loopback_finder.py:131-135. -
Detection: Uses FFT to look for the specific
target_bincorresponding to the test frequencysrc/gui/widgets/loopback_finder.py:146-148. -
Concurrency: The scan runs in a
LoopbackWorkerthread to keep the UI responsive during the hardware polling processsrc/gui/widgets/loopback_finder.py:26-58.
Sources: src/gui/widgets/loopback_finder.py:66-155