A microphone object is optional. You only need to make one if you want to change a property from default. Note for some properties you can also change the defaults themselves using pb_prefs, which is often more convenient.
An object of type microphone represents the high-precision PortAudio driver Psychtoolbox uses to record sound. There can only be one microphone object for an experiment. In an experiment script you can make one outside trials using function microphoneObject and add it using addToExperiment. Most commonly if you need one you're using a soundRecorder element.
See help text for Psychtoolbox functions InitializePsychSound and generally the Psychtoolbox website for technical notes on PortAudio with different operating systems and hardware.
Default: system default sound input device
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.
Default: 1 (mono)
Number of channels to record. 1 = mono, 2 = stereo, etc.
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.
PsychBench uses record properties to record information during experiments. You can't set record properties but you can see them in experiment results by listing them input property report.
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>.
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>.
PsychBench © 2017–2023 Giles Holland
Website © 2023 Giles Holland
End user license agreement