python - 为什么 Sounddevice InputStream 的录音会中断?
问题描述
我正在尝试使用InputStream
. 该程序运行良好,但有时会跳过一些位并且记录的长度比我想要的短。该代码取自具有多个线程的更大程序的功能。我不知道线程是否在这里造成了中断:
file = sf.SoundFile('outputj.wav', mode='x', samplerate=44100, channels=2)
def callback(indata, frames, time, status):
file.write(indata)
stream = sd.InputStream(samplerate=44100, device=18, channels=2, callback=callback)
stream.start()
input('Press return to save.')
stream.stop()
file.close()
有没有其他方法可以获得不间断的音频流?
解决方案
推荐阅读
- android - 从 api 获取数据并将其设置为消失后,进度条不会消失
- python - 使用 Angular http 客户端和烧瓶的 Kubernetes 微服务开发不起作用
- .net-core - Azure Pipeline dotnet push 错误查找 nuget 包
- css - 轮播中的活动图像
- c - 音频 PCM 信号中的忙音检测
- c# - 如何更改 TimePicker 的样式和颜色
- android - Android Studio:无法恢复密钥,有没有办法恢复 Android 密钥别名密码
- php - Xdebug: [Step Debug] 连接调试客户端超时,等待:200 ms。试过:本地主机:9003
- javascript - 如何将“数字”从巨大的数据集文件转换为实际数字?
- r - 从 read.table 获取数据的 ggplot2 直方图