Showing
1 changed file
with
14 additions
and
0 deletions
get_device_check.py
0 → 100644
1 | +import pyaudio | ||
2 | + | ||
3 | +p = pyaudio.PyAudio() | ||
4 | + | ||
5 | +# Print number of available devices | ||
6 | +num_devices = p.get_device_count() | ||
7 | +print("Number of devices:", num_devices) | ||
8 | + | ||
9 | +# Print details for each device | ||
10 | +for i in range(num_devices): | ||
11 | + device_info = p.get_device_info_by_index(i) | ||
12 | + print("Device", i, " - ", device_info["name"]) | ||
13 | + print(" Channels: ", device_info["maxInputChannels"], "input / ", device_info["maxOutputChannels"], "output") | ||
14 | + print(" Default Sample Rate: ", device_info["defaultSampleRate"]) |
-
Please register or login to post a comment