# JSDoc: Class: AudioClip

# Class: AudioClip

## sound.AudioClip(options)

#### new AudioClip(options)

AudioClip encapsulates an audio recording.

##### Parameters:

Name | Type | Description
--- | --- | ---

`options`

Object

###### Properties

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`psychoJS` | module:core.PsychoJS |  |  | the PsychoJS instance
`name` | String | <optional> | 'audioclip' | the name used when logging messages
`format` | string |  |  | the format for the audio file
`sampleRateHz` | number |  |  | the sampling rate
`data` | Blob |  |  | the audio data, in the given format, at the given sampling rate
`autoLog` | boolean | <optional> | false | whether or not to log

Source:
  - sound/AudioClip.js, line 15

### Members

#### (readonly) Engine :Symbol

Recognition engines.

##### Type:

- Symbol

Source:
  - sound/AudioClip.js, line 453

### Methods

#### download()

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

Source:
  - sound/AudioClip.js, line 166

#### getDuration() → {Promise.<number>}

Get the duration of the audio clip, in seconds.

Source:
  - sound/AudioClip.js, line 118

##### Returns:

the duration of the audio clip

Type
  Promise.<number>

#### setVolume(volume)

Set the volume of the playback.

##### Parameters:

Name | Type | Description
--- | --- | ---
`volume` | number | the volume of the playback (must be between 0.0 and 1.0)

Source:
  - sound/AudioClip.js, line 53

#### startPlayback()

Start playing the audio clip.

Source:
  - sound/AudioClip.js, line 66

#### startPlayback(fadeDurationopt)

Stop playing the audio clip.

##### Parameters:

Name | Type | Attributes | Default | Description
--- | --- | --- | --- | ---
`fadeDuration` | number | <optional> | 17 | how long the fading out should last, in ms

Source:
  - sound/AudioClip.js, line 102

#### upload()

Upload the audio clip to the pavlovia server.

Source:
  - sound/AudioClip.js, line 134