-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathloopback.py
More file actions
executable file
·71 lines (58 loc) · 2.37 KB
/
loopback.py
File metadata and controls
executable file
·71 lines (58 loc) · 2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/env python3
"""Subset of the PortAudio loopback test.
No automatic scanning.
No ...
"""
import sounddevice as sd
print('PortAudio LoopBack Test')
# TODO default settings
# inputDevice = paNoDevice;
# outputDevice = paNoDevice;
# sampleRate = -1;
# framesPerBuffer = -1;
# inputLatency = -1;
# outputLatency = -1;
# waveFilePath = ".";
# saveBadWaves
# verbose
# TODO arg parsing
# paloopback [-i# -o# -l# -r# -s# -m -w -dDir]
# -i# - Input device ID. Will scan for loopback cable if not specified.
# -o# - Output device ID. Will scan for loopback if not specified.
# -l# - Latency for both input and output in milliseconds.
# --inputLatency # Input latency in milliseconds.
# --outputLatency # Output latency in milliseconds.
# -r# - Sample Rate in Hz. Will use multiple common rates if not specified.
# -s# - Size of callback buffer in frames, framesPerBuffer. Will use common values if not specified.
# -w - Save bad recordings in a WAV file.
# -dDir - Path for Directory for WAV files. Default is current directory.
# -m - Just test the DSP Math code and not the audio devices.
# -v - Verbose reports.
# TODO justMath
# printf("Option -m set so just testing math and not the audio devices.\n");
# TODO PaQa_TestAnalyzer()
# TestSavedWave()
# * Simple test that writes a sawtooth waveform to a file. "test_sawtooth.wav"
# TestSingleMonoTone()
# * Detect a single tone. "exact frequency match"/"wrong frequency"
# TestMixedMonoTones()
# * Mix multiple tones and then detect them. NUM_TONES = 5
# TestDetectPhaseErrors()
# // Detect dropped or added samples in a sine wave recording.
# TestNotchFilter()
# * Generate a tone then knock it out using a filter.
# * Also check using filter slightly off tune to see if some energy gets through.
# TestDetectPops()
# // Detect pops that get back in phase.
# TestInitialSpike()
# * Test analysis when there is a DC offset step before the sine signal.
# TODO TestSampleFormatConversion()
print('PortAudio version number = {}\nPortAudio version text = {!r}'.format(*sd.get_portaudio_version()))
print('=============== PortAudio Devices ========================')
print(sd.query_devices())
# printf( "no devices found.\n" );
# printf( "=============== Detect Loopback ==========================\n" );
# ScanForLoopback(&userOptions);
# TODO PaQa_CheckForLoopBack
# TODO PaQa_AnalyzeLoopbackConnection
# TODO PaQa_SingleLoopBackTest