Documentation

玩blocking

Play audio fromaudioplayerobject, holding control until playback completes

Syntax

玩blocking(playerObj)
玩blocking(playerObj,start)
玩blocking(playerObj,[start,stop])

Description

玩blocking(playerObj)玩s the audio associated withaudioplayerobject玩erObjfrom beginning to end.玩blockingdoes not return control until playback completes.

玩blocking(playerObj,start)玩s audio from the sample indicated bystartto the end.

玩blocking(playerObj,[start,stop])玩s audio from the sample indicated bystartto the sample indicated bystop.

Examples

expand all

Play two audio samples with and without blocking using theand玩blockingmethods.

Load data from example fileschirp.matandgong.mat.

chirpData = load('chirp.mat'); chirpObj = audioplayer(chirpData.y,chirpData.Fs); gongData = load('gong.mat'); gongObj = audioplayer(gongData.y,gongData.Fs);

Play the samples with blocking, one after the other.

玩blocking(chirpObj); playblocking(gongObj);

Play without blocking. The audio can overlap.

玩(chirpObj); play(gongObj);

Play audio from the example filehandel.matstarting 4 seconds from the beginning.

loadhandel.mat;playerObj = audioplayer (y, Fs);开始=玩erObj.SampleRate * 4; play(playerObj,start);

Play the first 3 seconds of audio from the example filehandel.mat.

loadhandel.mat;playerObj = audioplayer (y, Fs);start = 1; stop = playerObj.SampleRate * 3; play(playerObj,[start,stop]);

See Also

|

Topics

Was this topic helpful?