microphone device object

A microphone object is optional. You only need to add one if you want to change a property from default. Note you can also change the default values themselves using pb_prefs at the MATLAB command line, which may be more convenient.

An object of type microphone represents the high-precision PortAudio driver Psychtoolbox uses to record sound. Most commonly if you want one, you're using a soundRecorder element. An experiment can only have one microphone object. You can add columns setting properties for it in the optional table for objects not specific to trial (experiment, device, staircase objects). [Or in the coding method: Make a microphone object outside trials using function microphoneObject, set properties, and input it to addToExperiment.]

See help text for Psychtoolbox functions InitializePsychSound and generally the Psychtoolbox website for technical notes on PortAudio with different operating systems and hardware.

Input properties
Record properties
microphone objects

n_device
numChannels

sampleRate

All objects
report
info

n_device

Default, changeable in pb_prefs: system default sound input device

A system can have multiple internal sound input “devices”. n_device is an integer setting device to use (0, 1, 2, …). See also record property n_device_r below.

You can use Psychtoolbox PsychPortAudio('GetDevices') to get a struct of available devices—n_device corresponds to numbers in field DeviceIndex. Devices with field NrInputChannels > 0 are input devices. Type help InitializePsychSound for more information from Psychtoolbox.

numChannels

Default, changeable in pb_prefs: 1 = mono

Number of channels to record. 1 = mono, 2 = stereo, etc.

sampleRate

Default, changeable in pb_prefs: device default sample rate

Sample rate to record at (Hz). Different internal sound devices can use different sample rates as well as have different default sample rates. You can change the sound device in n_device above, or change its sample rate in sampleRate here. 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. See also record property sampleRate_r below.

Input properties
Record properties

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.

microphone objects

n_device_r
sampleRate_r

n_device_r

Internal sound device number. You can set device using input property n_device above. This records the result in case you leave n_device at default.

sampleRate_r

Sample rate of recording. You can set a sample rate using input property sampleRate above. This records the result in case you leave sampleRate at default.