Trying to finish a final project that is due tomorrow.
I have to demo my program on my mac, but what I'm testing now is just producing errors, even when I simplify it to just playing my .wav files.
I listed:
[y Fs nBit] = wavread('audio.wav')
handles.runsound = audioplayer(y, 41000, 16)
play(handles.runsound);
The error reports that it cannot open the file at the first line.
Wavread reports, "error(wavread:InvalidFile', mag);
I got the same files/code to work on windows, and I can't find anything definitive that I can't use these functions with mac. Is there anything I should be using in place of them?
Thanks in advance.

답변 (3개)

the cyclist
the cyclist 2013년 3월 12일
편집: the cyclist 2013년 3월 12일

0 개 추천

This code (from "doc wavread") works for me on a Mac:
% Create WAV file in current folder.
load handel.mat
hfile = 'handel.wav';
wavwrite(y, Fs, hfile)
clear y Fs
% Read the data back into MATLAB, and listen to audio.
[y, Fs, nbits, readinfo] = wavread(hfile);
sound(y, Fs);

댓글 수: 2

Meaghan
Meaghan 2013년 3월 12일
can i make this work for .wav music files? (instead of loading a matlab audio file)
Walter Roberson
Walter Roberson 2013년 3월 12일
handel.wav is a .wav music file once it has been created by wavwrite()

댓글을 달려면 로그인하십시오.

Walter Roberson
Walter Roberson 2013년 3월 12일

0 개 추천

Picking a random file worked for me on OS-X Lion, at least in R2013a. Well, the very first one gave me the message
Error using wavread (line 165)
Invalid Wave File. Reason: Data compression format (GSM 6.10) is not supported.
but the second one I picked worked fine.
arpit agarwal
arpit agarwal 2017년 7월 30일

0 개 추천

Error using wavread (line 165) Invalid Wave File. Reason: Data compression format (GSM 6.10) is not supported. this is show me when i read the wav file. what i do

댓글 수: 1

Walter Roberson
Walter Roberson 2017년 7월 30일
Unfortunately there is not really anything you can do. wavread() was a more limited routine, one that has not been available for several years now, so there is no updated version that can solve the problem. If you are using R2012b or later, you should be switching to audioread() which is more flexible in the files it supported.

댓글을 달려면 로그인하십시오.

카테고리

질문:

2013년 3월 12일

댓글:

2017년 7월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by