Hi,
I am setting up my audio-visual experiment. My code, which has video and audio, worked perfectly fine on my screen and computer (it is a PRIME B560M-A with Windows 11 version 22H2, 64-bit operating system and 11th Gen Intel(R) Core™ i7-11700). When moving the computer to the experimental booth, and connecting to another screen the script kept working, but we cannot hear any sounds. The computer itself plays sounds, so it must be because of Matlab. For the BasicSoundOutputDemo it was the same: script works fine, but no sounds are heard. Also when using audioplayer I have the same issue.
Some extra information regarding the code:
device = [];
I have tried 4 and 1 which corresponded to a different samplerate, but both to the headphones connected to my computer
% Read subjID_BA.wav en subjID_DA.wav files
[yBA, ~] = psychwavread(['C:\Users\Administrateur\Desktop\MATLAB\22_Pubert_Hear\stimuli\' subjID '_BA.wav']);
[yDA, ~] = psychwavread(['C:\Users\Administrateur\Desktop\MATLAB\22_Pubert_Hear\stimuli\' subjID '_DA.wav']);
wavedataBA = yBA';
wavedataDA = yDA';
nrChannelsBA = size(wavedataBA,1); % Number of rows == number of channels.
nrChannelsDA = size(wavedataDA,1);
% Make sure we have always 2 channels stereo output.
if nrChannelsBA < 2 || nrChannelsDA < 2
wavedataBA = [wavedataBA ; wavedataBA];
wavedataDA = [wavedataDA ; wavedataDA];
end
nrChannels = 2;
% Open the audio device, with default mode [] (only playback),
% and a required latencyclass of zero 0 = no low-latency mode, as well as
% a frequency stored in exp.var.fs and nrChannels sound channels.
% This returns a handle to the audio device:
try
% Try with the frequency we wanted:
pahandle = PsychPortAudio('Open', device, [], 0, exp.var.fs, nrChannels);
catch
% Failed. Retry with default frequency as suggested by device:
fprintf('\nCould not open device at wanted playback frequency of %i Hz. Will retry with device default frequency.\n');
fprintf('Sound may sound a bit out of tune, ...\n\n');
psychlasterror('reset');
pahandle = PsychPortAudio('Open', device, [], 0, [], nrChannels);
end
*Later in the script I use*
PsychPortAudio('FillBuffer', pahandle, wavedataBA);
PsychPortAudio('Start', pahandle); WaitSecs(1);
Extra information regarding the output:
Could not open device at wanted playback frequency of Sound may sound a bit out of tune, …
PTB-INFO: New audio device -1 with handle 6 opened as PortAudio stream:
PTB-INFO: For 2 channels Playback: Audio subsystem is MME, Audio device name is Headphones (2- High Definition
PTB-INFO: Real samplerate 44100.000000 Hz. Input latency 0.000000 msecs, Output latency 180.317460 msecs.
I have the feeling that it can be a simple setting, so if anyone has any advice, I would be very grateful !
Thank you,
Have a nice day,
Ellen