Introduce sound into matlab
1 view (last 30 days)
Show older comments
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 Comments
Answers (1)
Jan
on 12 Jan 2012
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.
See Also
Categories
Find more on Audio and Video Data in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!