필터 지우기
필터 지우기

Introduce sound into matlab

조회 수: 1 (최근 30일)
Daniel
Daniel 2012년 1월 12일
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?

답변 (1개)

Jan
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.
  댓글 수: 1
Daniel
Daniel 2012년 1월 12일
That works for a sample audio. However, when I try to load my own audio file, either in the code or in the command line, it says that it cannot find the file. When I try to import it, MATLAB runs out of memory. Any idea how to fix those problems?

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

카테고리

Help CenterFile Exchange에서 Audio and Video Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by