Reading .wav file in Matlab Coder

别等时光非礼了梦想. 提交于 2019-12-11 08:45:39

问题


I want to read an audio file with matlab coder. The problem is that wavread() is not supported, but as this is a pretty essential part of any audio coding I am thinking that there must be another way to achieve this? Any ideas?


回答1:


What is your use case? If you really just want to run the generated code in a MEX-function within MATLAB you can use coder.extrinsic to call wavread. This will not work outside of the MATLAB environment.

Outside the MATLAB environment, you will need to use custom C code integration.




回答2:


The WAV file format is fairly simple & widely documented for example here. You can use the low-level file IO functions, fopen(), fread(), fseek to read the file, assuming these are themselves available. This is exactly what wavread() does internally - take a look at the source.




回答3:


fopen() is now supported starting from Matlab 2013a. See here.



来源:https://stackoverflow.com/questions/9499270/reading-wav-file-in-matlab-coder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!