Docs @ Psychtoolbox Wiki : PsychPortAudio

Search PTB Function help:
homepsychtoolbox.orgpage updateslogin



High precision sound driver for Psychtoolbox-3.

PsychPortAudio is a new sounddriver for PTB-3. It is meant to become a
replacement for all other Matlab based sound drivers and PTB's old SND()

Inside MATLAB:

PsychPortAudio has subfunctions;

for a list overview of supported subfunctions

>> PsychPortAudio Subfunctionname?

for help on a specific subfunction.


  1. Features
  2. See also
  3. Usage
  4. Caution


PsychPortAudio provides the following features:



InitializePsychSound for more info on low-latency configurations.
BasicSoundOutputDemo for a very basic demo of sound output (without special emphasis on low-latency).
BasicSoundInputDemo for a basic demo of sound capture.
BasicSoundFeedbackDemo shows how to implement a simple audio feedback loop with controllable delay.

PsychPortAudioTimingTest is a script that we used for testing PA's sound onset
latency and accuracy. It also serves as an example on how to get perfectly
synched audio-visual stimulus onsets.



The red keywords are links for per-function documentation!

% PsychPortAudio - A sound driver built around the PortAudio sound library:

% General information:

version = PsychPortAudio('Version');
oldlevel = PsychPortAudio('Verbosity' [,level]);
count = PsychPortAudio('GetOpenDeviceCount');
devices = PsychPortAudio('GetDevices' [,devicetype] [, deviceIndex]);

% General settings:

[oldyieldInterval, oldMutexEnable, lockToCore1, audioserver_autosuspend] = PsychPortAudio('EngineTunables' [, yieldInterval] [, MutexEnable] [, lockToCore1] [, audioserver_autosuspend]);
oldRunMode = PsychPortAudio('RunMode', pahandle [,runMode]);

% Device setup and shutdown:

pahandle = PsychPortAudio('Open' [, deviceid][, mode][, reqlatencyclass][, freq][, channels][, buffersize][, suggestedLatency][, selectchannels][, specialFlags=0]);
pahandle = PsychPortAudio('OpenSlave', pamaster [, mode][, channels][, selectchannels]);
PsychPortAudio('Close' [, pahandle]);
oldOpMode = PsychPortAudio('SetOpMode', pahandle [, opModeOverride]);
oldbias = PsychPortAudio('LatencyBias', pahandle [,biasSecs]);
[oldMasterVolume, oldChannelVolumes] = PsychPortAudio('Volume', pahandle [, masterVolume][, channelVolumes]);
enable = PsychPortAudio('DirectInputMonitoring', pahandle, enable [, inputChannel = -1][, outputChannel = 0][, gainLevel = 0.0][, stereoPan = 0.5]);
[underflow, nextSampleStartIndex, nextSampleETASecs] = PsychPortAudio('FillBuffer', pahandle, bufferdata [, streamingrefill=0][, startIndex=Append]);
bufferhandle = PsychPortAudio('CreateBuffer' [, pahandle], bufferdata);
PsychPortAudio('DeleteBuffer'[, bufferhandle] [, waitmode]);
PsychPortAudio('RefillBuffer', pahandle [, bufferhandle=0], bufferdata [, startIndex=0]);
PsychPortAudio('SetLoop', pahandle[, startSample=0][, endSample=max][, UnitIsSeconds=0]);
startTime = PsychPortAudio('Start', pahandle [, repetitions=1] [, when=0] [, waitForStart=0] [, stopTime=inf] [, resume=0]);
startTime = PsychPortAudio('RescheduleStart', pahandle, when [, waitForStart=0] [, repetitions] [, stopTime]);
status = PsychPortAudio('GetStatus' pahandle);
[audiodata absrecposition overflow cstarttime] = PsychPortAudio('GetAudioData', pahandle [, amountToAllocateSecs][, minimumAmountToReturnSecs][, maximumAmountToReturnSecs][, singleType=0]);
[startTime endPositionSecs xruns estStopTime] = PsychPortAudio('Stop', pahandle [,waitForEndOfPlayback=0] [, blockUntilStopped=1] [, repetitions] [, stopTime]);
PsychPortAudio('UseSchedule', pahandle, enableSchedule [, maxSize = 128]);
[success, freeslots] = PsychPortAudio('AddToSchedule', pahandle [, bufferHandle=0][, repetitions=1][, startSample=0][, endSample=max][, UnitIsSeconds=0][, specialFlags=0]);



You *must* call InitializePsychSound before first invocation of
PsychPortAudio(), at least on MS-Windows, but possibly also on OS/X! If
you omit that call, initialization of the driver may fail with some
"Invalid MEX file" error from Matlab!

PsychPortAudio is built around a modified version of the free, open-source
PortAudio sound library for portable realtime sound:

Path   Retrieve current version of PsychPortAudio.m from berliOS: beta | view in WebSVN with changelog

Valid XHTML 1.0 Transitional :: Valid CSS :: Powered by WikkaWiki
Page was generated in 0.3765 seconds