Looping Audio with Audio Toolbox

조회 수: 9 (최근 30일)
Brian
Brian 2021년 5월 8일
답변: Brian 2021년 5월 8일
I am starting to look into using the Audio Toolbox (instead of playrec) to see if it offers more straightforward use. One thing I'm having a hard time with at the moment is looping audio, and it's absolutely a dealbreaker. I'd like to be able to generate 30-60 seconds of pink noise, or some other background noise, and loop it indefinitely (until some condition is met, and I'll likely put it in a timer so that it runs in the background). Unfortunately, the only examples I can find for playback use the isDone object function and send audio in frames until it's complete (though you could use other logicals in the while loop), and then it looks like you need to release the source object and writer before playing again. Am I missing something?

채택된 답변

Brian
Brian 2021년 5월 8일
And of course I find my own answer shortly after posting the question (even though I had been searching for a half hour previous to asking). Using dsp.SignalSource (and likely other signal generation functions in the DSP System Toolbox), you can set the "SignalEndAction" property to "Cyclic repetition." Then change the while loop logical to something other than isDone. Hope this helps somebody else.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Signal Generation에 대해 자세히 알아보기

제품


릴리스

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by