Matlab Freezes after playing tone couple of times.

조회 수: 3 (최근 30일)
Mohammad
Mohammad 2013년 8월 7일
Hi;
I built a Matlab program that presents tones to an individual. On the screen, the user is presented with two buttons, volume up, volume down. Each time they press on a button the amplitude of the tone changes and the new tone is presented. However, after going back and forth between volume up and volume down, matlab freezes and I get an error: "MATLAB has causes an internal error to occur"
The way I am generating the tone is as follows:
C = [y1 y2];
ap = audioplayer(C,Fs);
playblocking(ap);
This is part of a bigger code that is in a function that is being accessed each time the user tune up or down the volume.
Can MATLAB handle sound that is being played in quick succession? I notice that the problem is not present if I am only tuning up or down and not jumping back and forth inbetween those two.
Thanks for your help; Really appreciate it
  댓글 수: 4
Mohammad
Mohammad 2013년 8월 9일
@Jan Simon Hi sorry for the late reply. My personal computer has Matlab 2012a and the lab computer has a 2010a. The 2012a is hopeless lol. The 2010a works if I do not go click click click and I give it time.
Mohammad
Mohammad 2013년 8월 9일
편집: Mohammad 2013년 8월 9일
Did anyone tried it on MATLAB 2013?? Does it work better on it? And I am using uiwait and uiresume. Could this be affecting the program? Thanks

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

답변 (1개)

Daniel Shub
Daniel Shub 2013년 8월 8일
The standard MATLAB sound commands have overhead associated with stopping and starting the soundcard so you cannot do what you are trying in a simple way. In order to do what you want you need the lower level control of the soundcard that port audio provides. The DSP toolbox in "newer" versions of MATLAB (I think R2012a) provides port audio support, but I am not sure to what extent. I almost always suggest the PsychToolbox even though it comes with a lot of baggage compared to some of the stand alone functions (e.g., playrec or pa_wavplay). Given what you are trying to do, it sounds like the baggage may actually be helpful.
  댓글 수: 1
Mohammad
Mohammad 2013년 8월 9일
I see. I did some more research on the topic. Seems like a common problem. i saw some posts on how it works with Matlab 2007. I think i will have to download that and try it or go with the Psychtoolbox. Thanks.

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

카테고리

Help CenterFile Exchange에서 Timing and presenting 2D and 3D stimuli에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by