Main Content
play
Play audio from audiorecorder
object
Syntax
player
= play(recObj
)
player
= play(recObj
, start
)
player
= play(recObj
,
[start
stop
])
Description
plays
the audio associated with player
= play(recObj
)audiorecorder
object recObj
from
beginning to end, and returns an audioplayer
object.
plays
audio from the sample indicated by player
= play(recObj
, start
)start
to
the end.
plays
audio from the sample indicated by player
= play(recObj
,
[start
stop
])start
to
the sample indicated by stop
.
Examples
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:'); get(playerObj)
Play back only the first 3 seconds of the speech recorded in the previous example:
play(myVoice, [1 myVoice.SampleRate*3]);