Hi, I really need some help with this project. I am making a sequence of frequencies and they are all playing at once when I run the script. I need a way to delay or stop each function so that each function doesn't go until the the preceding one finishes. Thanks. -Thomas

댓글 수: 2

Stephen23
Stephen23 2015년 12월 15일
It sounds like these are callback functions, or something similar. Without seeing your code it is impossible for us to know how you are calling these functions. You can upload your code editng your question, clicking the paperclip button, and then clicking both the Choose file and Attach file buttons.
Thomas Lindstaedt
Thomas Lindstaedt 2015년 12월 16일
Okay, thank you for the instructions. Sorry, I am a little new to this.

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

답변 (1개)

Geoff Hayes
Geoff Hayes 2015년 12월 17일

0 개 추천

Thomas - you may want to consider using the audioplayer object to play your audio data as it has the playblocking function call which will play the audio and block (or hold control) until the playback completes (so subsequent lines of code will not execute until the audio has fully played). For example, we can replace your
sound(y);
call with
player = audioplayer(y,Fs);
playblocking(player);
where Fs is the sampling rate (which appears to be 10000 for many of your "notes" to the Star Wars theme). Try integrating the above into your code and see (or hear) what happens!

카테고리

질문:

2015년 12월 15일

답변:

2015년 12월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by