Microphone device object

A microphone object is optional. You only need to add one if you want to change a property from default. Note for some properties 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

n_device

Default: 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, …). <cd>[]<cd> = system default sound input device. 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.

If you need to set n_device, usually easiest is to use pb_prefs since it organizes device numbers and names in an easy menu.

numChannels

Default: 1 (mono)

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

sampleRate

Default: device default

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. <cd>[]<cd> = default sample rate for the current device. See also record property sampleRate_r below.

Input properties all objects have

report
info

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.

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 <cd>[]<cd>.

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 <cd>[]<cd>.