Hi!
I am using PsychPortAudio to play some sounds. Sometimes, after running my code, I got background noise in any sound I am playing on my computer (not only in MATLAB). Why could this be? I don’t get any error messages from MATLAB and it does not happen every time I run it. I wonder if, somehow, sometimes, the channel I create remains open. However, I use the function “PsychPortAudio(‘Close’)” and I did not get any warning, so I assume it is working correctly. I play several sounds in several loops, but the general structure of my code regarding sounds looks as follows:
**%Initializing**
InitializePsychSound;
pahandle=PsychPortAudio('Open',[],1,[],[],1,[],0.015);
**%Play the sound (at several points of my code)**
PsychPortAudio('FillBuffer',pahandle,mytone);
start_time=PsychPortAudio('Start',pahandle,1,0,0);
**%After playing all the sounds**
PsychPortAudio ('Stop', pahandle);
PsychPortAudio ('Close');
I managed to solve it through the sounds settings of my computer, but I would like to prevent this from happening again. Which could be the cause?
I am using the 3.0.16 version of Psychtoolbox in a Windows 10 Home, using MATLAB R2019a.
Thank you very much in advance!