# JSDoc: Class: Microphone

# Class: Microphone

## sound.Microphone(options, @param)

#### new Microphone(options, @param)

This manager handles the recording of audio signal.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---

`options`

Object

###### Properties

Name | Type | Description
--- | --- | ---
`psychoJS` | module:core.PsychoJS | the PsychoJS instance

`@param` | module:core.Window |  |  | options.win - the associated Window
`options.format` | string | <optional> | 'audio/webm;codecs=opus' | the format for the audio file
`options.sampleRateHz` | number | <optional> | 48000 | the audio sampling rate, in Hz
`options.clock` | Clock | <optional> |  | an optional clock
`options.autoLog` | boolean | <optional> | false | whether or not to log

Source:
  - sound/Microphone.js, line 17

### Members

#### flush

Submit a request to flush the recording.

Source:
  - sound/Microphone.js, line 245

#### pause

Submit a request to pause the recording.

Source:
  - sound/Microphone.js, line 145

#### resume

Submit a request to resume the recording.

resume has no effect if the recording was not previously paused.

Source:
  - sound/Microphone.js, line 190

#### start

Submit a request to start the recording.

Note that it typically takes 50ms-200ms for the recording to actually starts once a request to start has been submitted.

Source:
  - sound/Microphone.js, line 53

#### stop

Submit a request to stop the recording.

Source:
  - sound/Microphone.js, line 108

### Methods

#### (protected) _onChange()

Callback for changes to the recording settings.

Changes to the settings require the recording to stop and be re-started.

Source:
  - sound/Microphone.js, line 359

#### (protected) _prepareRecording()

Prepare the recording.

Source:
  - sound/Microphone.js, line 380

#### download(filename)

Offer the audio recording to the participant as a sound file to download.

##### Parameters:

Name | Type | Description
--- | --- | ---
`filename` | string | the filename

Source:
  - sound/Microphone.js, line 273

#### getRecording(tag, flushopt)

Get the current audio recording as an AudioClip in the given format.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`tag` | string |  |  | an optional tag for the audio clip
`flush` | boolean | <optional> | false | whether or not to first flush the recording

Source:
  - sound/Microphone.js, line 331

#### upload(tag)

Upload the audio recording to the pavlovia server.

##### Parameters:

Name | Type | Description
--- | --- | ---
`tag` | string | an optional tag for the audio file

Source:
  - sound/Microphone.js, line 293