Introduce sound into matlab
조회 수: 1 (최근 30일)
이전 댓글 표시
I have created a game using the cogent toolbox. I want to introduce an audio file (30 minutes) into the game that will run throughout the game. The file is 30 minutes long, however, it can be shortened to 10 minutes. It has beeps in random time intervals so cutting it shorter than 10 minutes would be problematic. When the person starts to play the game I want, the audio file begins playing as well. I have downloaded the mp3 versions of wavread and wavwrite.
My questions are as follows:
1) Is it possible to have the audio file play simultaneously with the game?
2) If I have to break it up, which I do since as a wav file it is 150mb and a mp3 is 8mb when it is 30 minutes long. Is there a way that I can get it to repeat 3 times?
댓글 수: 0
답변 (1개)
Jan
2012년 1월 12일
See audioplayer It can play asynchronously and you can define the StopFcn such that it restarts the sound three times.
There is a bug in Matlab 2011b (but not in 2009a), which crashs Matlab (restart required, not just an error), when the audioplayer object is deleted from inside the StopFcn. If the audioplayer-object is not cleared, a crash appears when exitting Matlab.
참고 항목
카테고리
Help Center 및 File Exchange에서 Audio and Video Data에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!