This is machine translation

Translated by Microsoft
Mouse over text to see original. Click the button below to return to the English verison of the page.


Play audio from audiorecorder object


player = play(recObj)
player = play(recObj, start)
player = play(recObj, [start stop])


player = play(recObj) plays the audio associated with audiorecorder object recObj from beginning to end, and returns an audioplayer object.

player = play(recObj, start) plays audio from the sample indicated by start to the end.

player = play(recObj, [start stop]) plays audio from the sample indicated by start to the sample indicated by stop.


Record 5 seconds of your speech with a microphone, and play it back. Display the properties of the audioplayer object.

myVoice = audiorecorder;

disp('Start speaking.');
recordblocking(myVoice, 5);
disp('End of recording. Playing back ...');

playerObj = play(myVoice);

disp('Properties of playerObj:');

Play back only the first 3 seconds of the speech recorded in the previous example:

play(myVoice, [1 myVoice.SampleRate*3]);
Was this topic helpful?