【问题标题】:PortAudioError: Error querying device -1 in google colab when using the sounddevice libraryPortAudioError:使用 sounddevice 库时在 google colab 中查询设备 -1 时出错
【发布时间】:2022-07-04 15:08:23
【问题描述】:

我已经安装并导入了所有必需的库(至少我是这么认为的):

!sudo apt-get install libportaudio2
!pip install sounddevice
import numpy as np
import matplotlib.pyplot as plt
import sounddevice as sd

运行此代码时出现以下错误:

wav_wave = np.array(tone, dtype=np.int16)
sd.play(wav_wave, blocking=True)
sd.stop()

下面的错误是由sd.play函数引起的。

PortAudioError: Error querying device -1

【问题讨论】:

    标签: python google-colaboratory python-sounddevice


    【解决方案1】:

    云服务器可能没有麦克风。这就是您收到此错误的原因。

    【讨论】:

      猜你喜欢
      • 2021-10-16
      • 1970-01-01
      • 2022-06-16
      • 1970-01-01
      • 2021-10-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-12-06
      相关资源
      最近更新 更多