Help with audio: error due to unsupported combination of audio parameters


I would be very grateful if you could offer any help, please?

I am currently trying to run a program in MATLAB that uses Psychtoolbox. Part of the code I am using relies on PsychPortAudio. The code runs smoothly on a desktop computer (Windows 10). However, when I try to run it on my laptop (also Windows 10) I get the following error message:

PTB-INFO: Enforcing script abortion and restoring desktop by executing Screen('CloseAll') now!

PTB-INFO: Please ignore the false error message (INTERNAL PSYCHTOOLBOX ERROR) caused by this...

PTB-INFO: Using specially modified PortAudio engine, based on offical version: PortAudio V19-devel WITH-DIM

PTB-ERROR: Desired audio parameters for device -1 unsupported by audio device. PortAudio reports this error: Invalid sample rate

PTB-ERROR: This could be, e.g., due to an unsupported combination of audio sample rate, audio channel allocation, or audio sample format.


              error:                PsychError_system

              general description:  Error reported by a system call

              specific description: Failed to open PortAudio audio device due to unsupported combination of audio parameters.

              module name:          PsychPortAudio

              subfunction call:     Open

              file name:            COMMON\PSYCHPORTAUDIO\PsychPortAudio.c

              function name:        PSYCHPORTAUDIOOpen

              line number:          2441

Undefined function or variable 'freq'.


Error in drawStimulus (line 365)

                              fprintf('\nCould not open device at wanted playback frequency of %i Hz. Will retry with

                              device default frequency.\n', freq);


Error in cfs_runner (line 118)

    answers{1,1} = drawStimulus(answers, stimulus_window, target_image1,target_image2, stimulus_targets_warmup,

    stimulus_showing_order, noise_textures, fade_rate, refresh_rate, noise_start_interval, noise_random_interval,

    fixation_cross_color, warmup, setup_matrix, noise_coord, info_coord, info_brd_coord, brd_coord, disparity, TimeOut,

    stimulus_loc, audioTiming, audioOff, answerKeys);


Error in run_experiment (line 126)

        cfs_runner(w_x1, w_x2, w_y1, w_y2, warmup, NoWarmups, noise_start_interval, noise_random_interval, fade_rate,

        refresh_rate, bgcolor, noise_data, fixation_cross_color, noise_coord, info_coord, info_brd_coord, brd_coord,

        disparity, TimeOut, stimulus_loc, randTrial, audioTiming, audioOff, answerKeys);

Thank you very much for your help!

it's hard to say for 100% sure without seeing the code, however from the error messages it seems that the experiment is asking the audio interface for a sampling frequency that the sound card on the laptop doesn't support.

and, it seems that the code has a fallback mechanism for trying an alternative frequency, but the fallback code has some bugs in it. so the fallback code exits with an error...