playing a nonstop audio file

조회 수: 2(최근 30일)
Mohamed Turkmani
Mohamed Turkmani 2022년 9월 6일
편집: Mohamed Turkmani 2022년 9월 7일
how can i play an audio file without stopping kinda like a loop in app designer
[y,Fs] = audioread(app.files);
sound(y,Fs)
this will just play it once

답변(1개)

jibrahim
jibrahim 2022년 9월 6일
You can use dsp.AudioFileReader with PlayCount set to Inf:
afr = dsp.AudioFileReader('speech_dft.mp3','PlayCount',Inf);
adw = audioDeviceWriter('SampleRate', afr.SampleRate);
while ~isDone(afr)
audio = afr();
adw(audio);
end
  댓글 수: 5
Mohamed Turkmani
Mohamed Turkmani 2022년 9월 7일
편집: Mohamed Turkmani 2022년 9월 7일
ok it is working the problem is when i press the button to increas the volume, it doesnt work in real time, it waits until the audio is done and repeats with the increased volume

댓글을 달려면 로그인하십시오.

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by