python-3.x - WinError 2: 使用 AudioSegment.from_file 时系统找不到指定的文件
问题描述
运行以下代码时出现错误:
from pydub import AudioSegment
import soundfile as sf
path_to_file=r"C:\Users\test.wav"
audio_signal, sample_rate = sf.read(path_to_file)
stereo_audio= AudioSegment.from_file(path_to_file)
在最后一行我收到以下错误:“FileNotFoundError:[WinError 2] 系统找不到指定的文件”
os.path.exists(path_to_file)
返回True
。
我也尝试过stereo_audio= AudioSegment.from_file(r"C:\Users\test.wav")
返回相同的错误。
有人可以帮我解决这个问题吗?我很感激任何帮助!谢谢
编辑:
我发现,我的 wav 文件在 float32 中。
[this](错误:未知格式:3(尝试读取音频 wavfile 时))是否意味着某些功能需要 int16?也许这就是为什么它不起作用?
解决方案
推荐阅读
- nginx - nginx 配置 / 文件夹从与 / 不同的路径运行
- prolog - 如何在 Prolog 中编写特定游戏?
- java - 如何重构这个 REST API Spring Boot 应用程序?
- python - 下期权订单时出现错误 201 交互式经纪人 tws
- python - 如何在 Python 中编写 eof?
- visual-studio - 在 Visual Studio 2019 上禁用建议列表自动调整大小?
- python - 如何在Django中通过views.py将多个值从models.py传递到HTML
- angular - 如何强制重定向到角度的特定路线?
- java - JavaFX中的Gluon客户端maven插件链接错误
- javascript - 寻找渲染功能将采用 HTML 并使用 react js 将样式应用于字符串