How to do synchronisation in audioplayer Matlab?
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I am trying to play 4 sounds one after one using playblocking function. Is there anything lik asynchronizing until one song is done?
I used playblocking, but when I pause the song, the first song haults, but then the next song plays. I tried using two loops to break the flow once the sample rate is over but that is also not working. Here's my UI:
![Image.jpg](https://www.mathworks.com/matlabcentral/answers/uploaded_files/270178/Image.jpeg)
Here's my play code:
global songnames;
global currentSong;
global player;
global pausing;
global currentRate;
if(pausing==1)
resume(player);
end
if(~isempty(currentSong))
%start=get(player,'CurrentSample');
%stop=get(player,'TotalSamples');
[y,Fs]=audioread(string(songnames(currentSong)));
player=audioplayer(y,Fs);
start=get(player,'CurrentSample');
stop=get(player,'TotalSamples');
for(i=1:length(songnames))
playblocking(player);
end
end
And here's the code for pause callback:
global player;
pause(player);
disp('Text in');
global pausing;
pausing=1;
Do let me know if you have any opinion on this. Kindly suggest a solution with functions available within 2019a.
0 Kommentare
Antworten (0)
Siehe auch
Kategorien
Mehr zu Audio and Video Data finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!