Dear Mario Kleiner,
I have a quick question regarding the PsychPortAudio('Stop')
function. According to the help documentation, this function is supposed to return four output parameters: [audioStartTimeEnd, endPositionSecs, xruns, audioStopTime]
. However, on my Apple M3 running macOS 14.7 (23H124), the parameters endPositionSecs
and audioStopTime
always return 0, which should reflect the stop time in seconds.
Below, I have included a snippet of my script that demonstrates the issue:
matlab
soundDevs = getOptimizedSoundDev(1, false);
soundDevs.fs = soundDevs.DefaultSampleRate;
estimatedMaxDur = 50 * 2.1; % 50 trials * 2.1 sec/trial
pahandle = PsychPortAudio('Open', soundDevs.DeviceIndex, 2, 2, soundDevs.DefaultSampleRate, 1, estimatedMaxDur);
PsychPortAudio('GetAudioData', pahandle, estimatedMaxDur); % Preparing the sound input buffer for capture
recordedAudio = [];
allAbsRecPos = [];
% Start recording
audioStartTime = PsychPortAudio('Start', pahandle, [], 0, 1);
fprintf('%s\n', 'Starting recording for 5 seconds...');
WaitSecs(5);
% Stop recording
audioStopSignTime1 = GetSecs;
[audioStartTimeEnd, endPositionSecs, xruns, audioStopTime] = PsychPortAudio('Stop', pahandle, 1);
audioStopSignTime2 = GetSecs;
% Get audio data
[tempAudioData, absRecPosition] = PsychPortAudio('GetAudioData', pahandle);
if ~isempty(tempAudioData)
recordedAudio = [recordedAudio, tempAudioData];
% Print debug info
fprintf('Recorded audio size: %d, Temp audio data size: %d\n', size(recordedAudio, 2), size(tempAudioData, 2));
allAbsRecPos = [allAbsRecPos, absRecPosition];
end
% Close the audio device
PsychPortAudio('Close', pahandle);
save debug_temp;
Could you please advise on how to obtain the endPositionSecs
and audioStopTime
parameters correctly instead of receiving 0?
Thank you for your assistance (My support authentication token is: e6946a5c-a341-4d64-a29e-23cac6b06d39).
Best regards,
Yang