---
url: 'https://adk.nht.io/api/@nhtio/adk/lib/utils/audio/functions/resampleTo.md'
---

# Function: resampleTo()

```ts
function resampleTo(
  pcm: Float32Array,
  fromRate: number,
  toRate: number,
): Float32Array;
```

Defined in: [src/lib/utils/audio.ts:29](https://github.com/NHTIO/ADK/blob/v1.20260713.1/src/src/lib/utils/audio.ts#L29)

Linearly resamples a mono PCM buffer from one sample rate to another.

## Parameters

| Parameter  | Type           | Description                    |
| ---------- | -------------- | ------------------------------ |
| `pcm`      | `Float32Array` | The source mono PCM samples.   |
| `fromRate` | `number`       | The source sample rate, in Hz. |
| `toRate`   | `number`       | The target sample rate, in Hz. |

## Returns

`Float32Array`

The resampled mono PCM samples, `Math.floor(pcm.length * toRate / fromRate)` long.

## Remarks

Pure resample only — no channel/downmix logic lives here (see [downmixToMono](downmixToMono.md) for that).
Uses linear interpolation between the two nearest source samples for each output sample; a
no-op (returns `pcm` as-is) when `fromRate === toRate`.
