Skip to main content
 首页 » 编程设计

python之python 中的 waveplay 等效命令

2024年10月01日10Leo_wl

我的 MATLAB 代码是:

x=wavread('C:\Users\dell\Desktop\Rabia Ahmad spring 2016\FYP\1. Matlab Work\record work\Recording.wav',58368); 
wavplay(x,58368) 

它在 Python 中的等效代码是:

x= sio.loadmat('C:\\Users\\dell\\Desktop\\Rabia Ahmad spring 2016\\FYP\\1. Matlab Work\\record work\\Recording.mat')['Recording'] 

我只想知道什么是 Python 中的 wavplay 等效命令 以便我可以播放我的文件?

请您参考如下方法:

在 Python 中有多种播放声音的工具。最直接的等价物是 play sounddevice 中的方法包裹。

加载文件的最简单方法是使用 read soundfile 中的方法包。

另请注意,wavread 和 wavplay 几年前已从 MATLAB 中删除。它们在最新版本的 MATLAB 中不再存在。我链接到的函数是更通用的函数/方法,等同于 audioread和 audioplayer.play几年前在 MATLAB 中取代 wavread 和 wavplay 的函数/方法。