Пишу программу, используя модуль PyAudio. При запуске тестовой проограммы вылетели звуковые устройства:
import pyaudio
from pprint import pprint
p = pyaudio.PyAudio()
pprint(p.is_format_supported(input_format=pyaudio.paInt8,
input_channels=1,
rate=44100,
input_device=0))
try:
stream = p.open(format=pyaudio.paInt8,
channels=1,
rate=44100,
input=True,
input_device_index=0,
frames_per_buffer=1024)
data = stream.read(1024)
except IOError as e:
print(e)
stream.stop_stream()
stream.close()
pprint(p.is_format_supported(input_format=pyaudio.paInt8,
input_channels=1,
rate=22050,
input_device=0))
try:
stream = p.open(format=pyaudio.paInt8,
channels=1,
rate=22050,
input=True,
input_device_index=0,
frames_per_buffer=1024)
data = stream.read(1024)
except IOError as e:
print(e)
stream.stop_stream()
stream.close()
p.terminate()
Спасла перезагрузка. У меня Windows 10.