ALSA Audio 抛出错误

ALSA Audio 抛出错误

我运行了一个使用 pyaudio 的 python 程序,并尝试使用我的电脑麦克风和扬声器,但出现了这个错误

ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.rear
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.center_lfe
ALSA lib pcm.c:2660:(snd_pcm_open_noupdate) Unknown PCM cards.pcm.side
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
ALSA lib pcm_route.c:877:(find_matching_chmap) Found no matching channel map
voice-transformation$ python: src/hostapi/alsa/pa_linux_alsa.c:3636: PaAlsaStreamComponent_BeginPolling: Assertion `ret == self->nfds' failed.
Aborted (core dumped)

这是用于启动流的 Python 代码

    def start(self):
        if self.in_stream is not None and self.out_stream is not None:
            return
        try:
            # Initialize PyAudio for Output
            self.p_out = pa.PyAudio()
            self.out_stream = self.p_out.open(
                format=self.FORMAT,
                channels=self.CHANNEL_OUTPUT,
                rate=self.RATE,
                output=True,
                frames_per_buffer=self.CHUNK,
            )
            self.out_stream.start_stream()

            # Initialize PyAudio for Input
            self.p = pa.PyAudio()
            self.in_stream = self.p.open(
                format=self.FORMAT,
                channels=self.CHANNEL_INPUT,
                rate=self.RATE,
                input=True,
                frames_per_buffer=self.CHUNK,
                stream_callback=self._process_stream,
            )
            self.in_stream.start_stream()
            # while self.in_stream.is_active():
            #     time.sleep(0.1)
        except KeyboardInterrupt:
            self.stop()
            pass

这是来自 python 程序的错误吗?我的电脑音频出现了错误吗?

相关内容