By default plays a beep at 440 hz (A). Or you can use property fileName or dataExpr to play a sound file or sound data. Times reported by record properties startTime/endTime correspond to sound start/end.
This uses the high-precision PortAudio driver in Psychtoolbox. A system can have multiple internal sound “devices”. If you want to change which sound device to use or other parameters, you can use pb_prefs -> speaker tab. Or to change for only the current experiment, you can add an object of type speaker and set its properties. See help text for the Psychtoolbox function InitializePsychSound and generally the Psychtoolbox website and PsychPortAudio documentation for technical notes on PortAudio with different operating systems and hardware.
Mono sound plays on all channels open on the device. To set open channels, see in pb_prefs or speaker object property numChannels (default = 2).
IMPORTANT: Psychtoolbox PortAudio is designed so that parameters like device sample rate need to match the sound file/data to reduce resource usage for best timing precision. If not, the element will throw an error for a file or play distorted (sped up or slowed down) for data. Different internal sound devices can use different sample rates as well as have different default sample rates. You can change the sound device or its sample rate using in pb_prefs or with speaker object properties n_device, sampleRate. If you set a sample rate the current device cannot use, Psychtoolbox will give an error. Common rates are 44,100 and 48,000 Hz.
Tip: If sound output is crackly on your system, try changing speaker object properties priority and/or latency (try increments of 0.005 sec for latency), typically in pb_prefs.
See also element type beep.
At default plays a beep until a condition you set in property end. Or if you use property fileName or dataExpr, by default ends on its own when the file/data ends. You can change this using properties times/maxNumLoops/phase.
"Ends on its own" means ends automatically at that point. If an element can end on its own, you don't need to set end conditions for it in property end (unless you want it to maybe end earlier).
No—runs until any condition you set in property end.
fileName
dataExpr
beepFrequency
times
maxNumLoops
breakInterval
phase
speed
volume
reportTimeout
All visual elements
position
depth
nn_eyes
rotation
flipHorz
flipVert
colorMask
alpha
intensity
contrastMult
convolution
shader
filterOrder
filterGrayscale
filterResolutionMult
filterGamma
channelResolution
backColor
addDisplay
All visual elements
position
All adjuster elements have
adjust
All response handler elements
translateResponse
scoreResponse
correctResponse
scoreResponseForStaircase
maxNumResponses
recordDefaultResponse
registerTrigger
autoResponse
autoResponseLatency
All elements
start
end
startBuffer
endBuffer
vary
staircase
All objects
info
report
Defaults: play a beep until a condition you set in property end
e.g.
<cds>"soundData"<cds>
<cds>"sounds{5}"<cds>
<cds>"albums.meows(2).sound"<cds>
Default: 440 Hz (A)
If you don't set fileName or dataExpr, this is the frequency of the beep to play (Hz).
Default: play whole sound file/data
You can set this to a vector [t1 t2] (sec) to play only a specific time range in the sound file/data. t1 = <cd>0<cd> = start, t2 = <cd>inf<cd> = end. If you combine with maxNumLoops/breakInterval/phase below, those properties work within the part specified here.
Default: maxNumLoops = play once
Default: breakInterval = no interval between loops
Default: phase = start at start of sound file/data
breakInterval is silent interval to add to end of the sound file/data or time range (sec). 0 = none. Generally use this if you want to have a break between loops. Note this simply adds to the length of the file/data, so for example if you set maxNumLoops = 1.5, that applies to the length including break.
phase is start time in the sound file/data or time range (sec). 0 = start. phase is best used to set a starting point for a looping stimulus. If you just want to play the file/data from a certain point to its end (or from a certain point to its start playing in reverse), use times above instead with maxNumLoops = 1.
Default: play forward
Currently only +1 = play forward, −1 = play backward.
Default: current system volume
A number between 0–1: 0 = no sound, 1 = current system volume. This scales the volume in your system sound settings. Mainly useful if you want different sound elements to play at different volumes.
Default: 0.5 sec
Alternatively 0 = don't wait and disable the warning that report was not received. This can be useful if you are getting the warning in an experiment where timing doesn't matter.
You can vary or allow the subject to adjust the following properties of an object of this type when it's running. If you need to make other properties adjustable, you can edit the element type code—see Element Type Programming Manual.
position
nn_eyes
rotation
colorMask
alpha
intensity
contrastMult
drawCodeVars
(None)
(None)
PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results using input property report.
All response handler elements
response
responseScore
responseTime
responseLatency
d_responseTime
numResponses
All elements
startTime
endTime
duration
n_startFrame
n_endFrame
startLatencyBufferable
endLatencyBufferable