www.gusucode.com > dsp 案例源码程序 matlab代码 > dsp/ReadAndPlayBackAnAudioFileExample.m
%% Read and Play back an Audio File % This example shows how to read and play back an audio file using % the standard audio output device. %% % *Note*: This example runs only in R2016b or later. If you are using an % earlier release, replace each call to the function with the equivalent % |step| syntax. For |dsp.AudioFileReader| System object(TM), myObject() % becomes step(myObject). For all other objects, myObject(x) becomes % step(myObject,x). hmfr = dsp.AudioFileReader('speech_dft.mp3'); hap = audioDeviceWriter('SampleRate', hmfr.SampleRate); while ~isDone(hmfr) audio = hmfr(); hap(audio); end release(hmfr); release(hap);