MATLAB: Error trying to play sound

play error

Hi i wanted to use "play" to play the audioplayer(data,fs). 'GUI1' is a .m and .fig.
[data,fs]=wavread('test');
play(audioplayer(data,fs))
error:
Error using GUI1>play
Too many input arguments.
Error in GUI1>buttonPlay_Callback (line 286)
play(player);
Error in gui_mainfcn (line 96)
feval(varargin{:});
Please help, How can i solve this?

Best Answer

Use the soundsc function instead:
soundsc(data,fs)
The play function is for audioplayer objects. You seem to have a ‘.wav’ file instead, so soundsc or sound would likely work best for you here.