# Random crashing with Psychtoolbox portaudio and Win 7 64 with R2015A

**URL:** <https://psychtoolbox.discourse.group/t/random-crashing-with-psychtoolbox-portaudio-and-win-7-64-with-r2015a/229>\
**Category:** Uncategorized\
**Created:** [October 20, 2015, 10:07pm UTC](https://psychtoolbox.discourse.group/t/random-crashing-with-psychtoolbox-portaudio-and-win-7-64-with-r2015a/229 "2015-10-20T22:07:14Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dgb\_007](https://avatars.discourse-cdn.com/v4/letter/d/f4b2a3/32.png) [@dgb\_007](https://psychtoolbox.discourse.group/u/dgb_007)\
**Post date:** [October 20, 2015, 10:07pm UTC](https://psychtoolbox.discourse.group/t/random-crashing-with-psychtoolbox-portaudio-and-win-7-64-with-r2015a/229/1 "2015-10-20T22:07:14Z")

</div>

Hi all,  
  
I am experiencing a random crash of Matlab with the Psychtoolbox and is seems to be related to the portaudio DLL.&nbsp; The machine can run the script fine, but when it falls over it is a major crash.  
  
I have contacted Mathworks, and they pointed me here.  
  
This crashing message has been experienced only on one machine of the total of 8 that are running the script.&nbsp; Of these 8, 5 are the same spec as the problematic machine (i.e. brand, CPU, memory, etc).   
  
The error causes the following Matlab violation error:  
  
---------------------------- START ERROR ------------------------------  
  
MATLAB crash file:C:\Users\CRCHEA~1\AppData\Local\Temp\matlab\_crash\_dump.3260-1:  
  
  
------------------------------------------------------------------------  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Access violation detected at Sat Oct 17 16:05:28 2015  
------------------------------------------------------------------------  
  
Configuration:  
&nbsp; Crash Decoding&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Disabled  
&nbsp; Crash Mode&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : continue (default)  
&nbsp; Current Graphics Driver: Intel Intel(R) HD Graphics 4600 Version 4.2.0 - Build 10.18.10.3412  
&nbsp; Default Encoding&nbsp;&nbsp;&nbsp; : windows-1252  
&nbsp; Graphics card 1&nbsp;&nbsp;&nbsp;&nbsp; : Intel Corporation ( 0x8086 ) Intel(R) HD Graphics 4600 Version 10.18.10.3412  
&nbsp; Host Name&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : MU00059493  
&nbsp; MATLAB Architecture : win64  
&nbsp; MATLAB Root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : C:\Program Files\MATLAB\R2015a  
&nbsp; MATLAB Version&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : 8.5.0.197613 (R2015a)  
&nbsp; OpenGL&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : hardware  
&nbsp; Operating System&nbsp;&nbsp;&nbsp; : Microsoft Windows 7 Enterprise   
&nbsp; Processor ID&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : x86 Family 6 Model 60 Stepping 3, GenuineIntel  
&nbsp; Virtual Machine&nbsp;&nbsp;&nbsp;&nbsp; : Java 1.7.0\_60-b19 with Oracle Corporation Java HotSpot(TM) 64-Bit Server VM mixed mode  
&nbsp; Window System&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; : Version 6.1 (Build 7601: Service Pack 1)  
  
Fault Count: 1  
  
  
Abnormal termination:  
Access violation  
  
Register State (from fault):  
&nbsp; RAX = 0000000000000000&nbsp; RBX = 00000000a58240d0  
&nbsp; RCX = 0000000000000020&nbsp; RDX = 0000000000000000  
&nbsp; RSP = 00000001d553fda0&nbsp; RBP = 0000000000000000  
&nbsp; RSI = 0000000000000020&nbsp; RDI = 000007fef02ab840  
&nbsp;  
&nbsp;&nbsp; R8 = 00000000a58240d0&nbsp;&nbsp; R9 = 0000000000000000  
&nbsp; R10 = 0000000000000000&nbsp; R11 = 0000000000000202  
&nbsp; R12 = 0000000000000000&nbsp; R13 = 0000000000000000  
&nbsp; R14 = 0000000000000000&nbsp; R15 = 000007fefa35ed00  
&nbsp;  
&nbsp; RIP = 000007fef02ab851&nbsp; EFL = 00010206  
&nbsp;  
&nbsp;&nbsp; CS = 0033&nbsp;&nbsp; FS = 0053&nbsp;&nbsp; GS = 002b  
  
Stack Trace (from fault):  
[&nbsp; 0] 0x000007fef02ab851 C:\toolbox\Psychtoolbox\PsychSound\portaudio\_x64.dll+00047185 PaAsio\_GetOutputChannelName+00012753  
[&nbsp; 1] 0x000007fefa332dde&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C:\Windows\system32\WINMM.dll+00011742 DriverCallback+00000110  
[&nbsp; 2] 0x000007fefa33a95d&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C:\Windows\system32\WINMM.dll+00043357 timeEndPeriod+00000501  
[&nbsp; 3] 0x00000000778559dd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C:\Windows\system32\kernel32.dll+00088541 BaseThreadInitThunk+00000013  
[&nbsp; 4] 0x0000000077a8a651&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; C:\Windows\SYSTEM32\ntdll.dll+00173649 RtlUserThreadStart+00000033  
  
  
If this problem is reproducible, please submit a Service Request via:  
&nbsp;&nbsp;&nbsp; http://www.mathworks.com/support/contact\_us/  
  
----------------------------  
  
The Mathworks support noticed the portaudio\_x64.dll line and hence were unable to assist further.  
  
The setup code for the portaudio functions we are using is:  
  
---------------------------- START CODE ---------------------------  
  
%% SOUND STUFF  
%% Psychportaudio  
wave=sin(1:0.25:1000);  
freq=22254; % change this to change freq of tone  
nrchannels = size(wave,1);  
% Initialize driver, request low-latency preinit:  
InitializePsychSound(1)  
%  
%20150727\>\>  
% Default to auto-selected default output device:  
%find device index name 'Primary Sound Driver'  
devices = PsychPortAudio('GetDevices')  
size\_devices = size(devices);  
devicetarget = 'Speakers / Headphones (Realtek High Definition Audio)';  
iLoop = 1;  
while iLoop \< size\_devices(2)  
&nbsp;&nbsp;&nbsp; %%possible use strfind for different search string or partial string  
&nbsp;&nbsp;&nbsp; if strcmp(devices(iLoop).DeviceName, devicetarget)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;  
&nbsp;&nbsp;&nbsp; end  
&nbsp;&nbsp;&nbsp; iLoop = iLoop + 1;  
end  
iLoop  
devices(iLoop)  
deviceid = devices(iLoop).DeviceIndex  
%deviceid = 15  
%OLD  
%deviceid = -1; %DEFAULT  
%%deviceid = 2; %No Roland Connected  
%\<\<  
%  
% Request latency mode 2, which used to be the best one in our measurement:  
reqlatencyclass = 2; % class 2 empirically the best, 3 & 4 == 2  
% Open audio device for low-latency output:  
%pahandle = PsychPortAudio('Open' [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);  
pahandle = PsychPortAudio('Open', deviceid, [], reqlatencyclass, freq, nrchannels)  
%END SETUP  
  
------------------------------------  
  
I would be interested to know if there has been other issue with users like this and what methods were used to work around it.  
  
Rgds,  
DaveB
