노현욱

Device 정보 ㅊ출

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"])