---
title: Time and pitch
order: 6
summary: Change speed without pitch and pitch without speed, and fit audio to a length.
---

<!-- Generated by tools/generate-docs.bxs from the BIF classes. Do not edit; change the Javadoc and run it again. -->

Change speed without pitch and pitch without speed, and fit audio to a length.

## audioStretch

Change the speed of audio without changing its pitch

```js
audioStretch( audio, rate )
```

| Argument | Type | Default | |
|---|---|---|---|
| `audio` | any | required | The audio buffer. |
| `rate` | double | required | Speed factor between 0.25 and 4. 1.25 is 25 percent faster and shorter, 0.8 is slower and longer. |

**Returns** A new audio buffer.

## audioFitTo

Change the length of audio to a number of seconds without changing its pitch

```js
audioFitTo( audio, seconds )
```

| Argument | Type | Default | |
|---|---|---|---|
| `audio` | any | required | The audio buffer. |
| `seconds` | double | required | The length to reach, in seconds. The change in speed should stay within about 25 percent for natural results. |

**Returns** A new audio buffer of that length.

## audioPitch

Change the pitch of audio without changing its length

```js
audioPitch( audio, semitones )
```

| Argument | Type | Default | |
|---|---|---|---|
| `audio` | any | required | The audio buffer. |
| `semitones` | double | required | Up (positive) or down (negative) in semitones, within 24. 12 is one octave. |

**Returns** A new audio buffer.

