Hi everyone,
I am performing an EEG experiment using Psychtoolbox to display the stimuli. In short, I play 500 stimuli of a female speaker pronouncing /ba/ after each other. So, it is a video+sound. Sometimes, around 12 times out of 500, we hear a click or distorted piece of sound. This is not favourable as we are trying to record an MMN (a signal do deviant sounds).
This is my code to play the video:
windowrect = [];
screenid = max(Screen('Screens'));
win = Screen('OpenWindow', screenid, 0, windowrect);
if currentStimulus == 1 && currentReaction == 0
STDmovie = Screen('OpenMovie', win, STDmoviename);
%tBeforeTrigger = GetSecs()-startSecs
if is_EEG_present
fwrite(s,2);
end
Screen('PlayMovie', STDmovie, 1);
while 1
tex = Screen('GetMovieImage', win, STDmovie);
if tex>= 0
[pressed, firstPress]=KbQueueCheck(deviceIndex);
timeSecs = firstPress(find(firstPress));
if pressed
if is_EEG_present
fwrite(s,00);
end
KeyName = KbName(min(find(firstPress)));
TimePressed = timeSecs - startSecs;
fprintf('"%s" typed at time %.3f seconds\n', KeyName, TimePressed);
AllKeysPressed = [AllKeysPressed, KeyName];
AllTimePressed = [AllTimePressed, TimePressed];
end
else tex<= 0;
% We're done, break out of loop:
break;
end
%tBeforeVideo = GetSecs()-startSecs
Screen('DrawTexture', win, tex);
Screen('Flip', win);
Screen('Close', tex);
end
Screen('PlayMovie', STDmovie, 0);
Screen('CloseMovie', STDmovie);
end
We noticed this info multiple times in the command window:
“PTB-INFO: Movie playback had to drop 3 (or 5 or 9 or 2… in other commands) frames of movie 0 to keep playback in sync.”
Could our distorted sounds/click have anything to so with this info? And does anyone know how we could avoid this error/bug?
Thank you for your advice and tips,
have a great weekend,
Ellen