如何读取MP3 MATLAB [英] How to read MP3 in MATLAB

查看:800
本文介绍了如何读取MP3 MATLAB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前工作在Matlab水印的音频文件为一个数学研究项目。到目前为止,我已经能够读取在Matlab使用wavread wav文件。但是,因为wav文件非常大,所得到的数据也大。因此,为了简化这一点,我想知道我怎么就能够在Matlab中读取MP3文件。到目前为止,我只尝试用dsp.AudioFileReader读一个MP3。然而,所得到的数据只包含0的和其他一些数字,这显然是不正确的数据。会有人请能帮助我吗?太谢谢你了!

I am currently working on watermarking audio files in Matlab for a mathematics research project. So far I have been able to read wav files using wavread in Matlab. However, because wav files are very large, the resulting data is also large. Therefore, in order to simplify this I would like to know how I would be able to read an mp3 file in Matlab. So far I have only tried to read an mp3 by using dsp.AudioFileReader. However, the resulting data only contains 0's and a few other numbers, which is clearly not the correct data. Would someone please be able to help me? Thank you so much!

推荐答案

您可以使用此code:

you can use this code:

hfr = dsp.AudioFileReader('yourfile.mp3');
hplay = dsp.AudioPlayer('SampleRate',sample_rate_here);
 while ~isDone(hfr)
         audio = step(hfr);
         step(hplay, audio);
 end

这篇关于如何读取MP3 MATLAB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆