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

**URL:** <https://psychtoolbox.discourse.group/t/help-with-audio-error-due-to-unsupported-combination-of-audio-parameters/59>\
**Category:** Uncategorized\
**Created:** [June 11, 2018, 1:41pm UTC](https://psychtoolbox.discourse.group/t/help-with-audio-error-due-to-unsupported-combination-of-audio-parameters/59 "2018-06-11T13:41:40Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Allen\_Ingling](https://avatars.discourse-cdn.com/v4/letter/a/a183cd/32.png) [@Allen\_Ingling](https://psychtoolbox.discourse.group/u/Allen_Ingling)\
**Post date:** [June 11, 2018, 1:41pm UTC](https://psychtoolbox.discourse.group/t/help-with-audio-error-due-to-unsupported-combination-of-audio-parameters/59/1 "2018-06-11T13:41:40Z")

</div>

Hello

  

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.

INTERNAL PSYCHTOOLBOX ERROR

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; error:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PsychError\_system

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; general description:&nbsp; Error reported by a system call

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; module name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PsychPortAudio

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; subfunction call:&nbsp;&nbsp;&nbsp;&nbsp; Open

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; file name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; COMMON\PSYCHPORTAUDIO\PsychPortAudio.c

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; function name:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PSYCHPORTAUDIOOpen

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; line number:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2441

Undefined function or variable 'freq'.

&nbsp;

Error in drawStimulus (line 365)

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

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;device default frequency.\n', freq);

&nbsp;

Error in cfs\_runner (line 118)

&nbsp;&nbsp;&nbsp; answers{1,1} = drawStimulus(answers, stimulus\_window, target\_image1,target\_image2, stimulus\_targets\_warmup,

&nbsp;&nbsp;&nbsp; stimulus\_showing\_order, noise\_textures, fade\_rate, refresh\_rate, noise\_start\_interval, noise\_random\_interval,

&nbsp;&nbsp;&nbsp; fixation\_cross\_color, warmup, setup\_matrix, noise\_coord, info\_coord, info\_brd\_coord, brd\_coord, disparity, TimeOut,

&nbsp;&nbsp;&nbsp; stimulus\_loc, audioTiming, audioOff, answerKeys);

&nbsp;

Error in run\_experiment (line 126)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; cfs\_runner(w\_x1, w\_x2, w\_y1, w\_y2, warmup, NoWarmups, noise\_start\_interval, noise\_random\_interval, fade\_rate,

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; refresh\_rate, bgcolor, noise\_data, fixation\_cross\_color, noise\_coord, info\_coord, info\_brd\_coord, brd\_coord,

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; disparity, TimeOut, stimulus\_loc, randTrial, audioTiming, audioOff, answerKeys);

&nbsp;

Thank you very much for your help!

Zelie

&nbsp;

---

<div class="post-metadata">

**Author:** ![elladawu](https://avatars.discourse-cdn.com/v4/letter/e/71c47a/32.png) [@elladawu](https://psychtoolbox.discourse.group/u/elladawu)\
**Post date:** [June 11, 2018, 11:33pm UTC](https://psychtoolbox.discourse.group/t/help-with-audio-error-due-to-unsupported-combination-of-audio-parameters/59/2 "2018-06-11T23:33:48Z")

</div>

hi,

  

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...
