<br />

MediaPipe Audio Task that performs automatic speech recognition (ASR) in unary and streaming modes via WASM SIMD or WebGPU.

**Signature:**

```typescript
export declare class AudioTranscriber extends TaskRunner 
```

## Methods

| Method | Modifiers | Description |
|---|---|---|
| [createFromOptions(wasmFileset, options)](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscribercreatefromoptions) | `static` | Initializes the Wasm runtime and creates a new `AudioTranscriber` based on the provided options. |
| [createFromModelPath(wasmFileset, modelAssetPath)](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscribercreatefrommodelpath) | `static` | Initializes the Wasm runtime and creates a new `AudioTranscriber` from a model asset path. |
| [createFromModelBuffer(wasmFileset, modelAssetBuffer)](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscribercreatefrommodelbuffer) | `static` | Initializes the Wasm runtime and creates a new `AudioTranscriber` from a model asset buffer or stream. |
| [setOptions(options)](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscribersetoptions) |   | Sets the options for the `AudioTranscriber` and initializes the underlying engine. Options cannot be updated once the engine has been created. |
| [transcribe(audioSamples, endOfStream)](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscribertranscribe) |   | Transcribes mono PCM float audio samples in `[-1.0, 1.0]`. |
| [transcribeStream(audioSamples)](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscribertranscribestream) |   | Feeds a streaming chunk of mono PCM float audio samples (`endOfStream = false`) and returns any newly emitted interim or final segments. |
| [finishStream()](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscriberfinishstream) |   | Flushes any remaining buffered audio and finalizes the current stream. |
| [prewarm()](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscriberprewarm) |   | Prewarms the underlying inference engine to reduce first-chunk latency. |
| [close()](https://developers.google.com/edge/api/mediapipe/js/tasks-audio.audiotranscriber.md.txt#audiotranscriberclose) |   | Closes the `AudioTranscriber` and releases native engine and Wasm memory. |

## AudioTranscriber.createFromOptions()

Initializes the Wasm runtime and creates a new `AudioTranscriber` based on the provided options.

**Signature:**

```typescript
static createFromOptions(wasmFileset: WasmFileset, options: AudioTranscriberOptions): Promise<AudioTranscriber>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| options | AudioTranscriberOptions | The options for the AudioTranscriber. Note that either a path to the model or the model buffer itself must be provided via `baseOptions`. |

**Returns:**

Promise\<AudioTranscriber\>

## AudioTranscriber.createFromModelPath()

Initializes the Wasm runtime and creates a new `AudioTranscriber` from a model asset path.

**Signature:**

```typescript
static createFromModelPath(wasmFileset: WasmFileset, modelAssetPath: string | string): Promise<AudioTranscriber>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetPath | string \| string | The path or URL to the `.litertlm` model asset. |

**Returns:**

Promise\<AudioTranscriber\>

## AudioTranscriber.createFromModelBuffer()

Initializes the Wasm runtime and creates a new `AudioTranscriber` from a model asset buffer or stream.

**Signature:**

```typescript
static createFromModelBuffer(wasmFileset: WasmFileset, modelAssetBuffer: Uint8Array | ReadableStreamDefaultReader): Promise<AudioTranscriber>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| wasmFileset | WasmFileset | A configuration object that provides the location of the Wasm binary and its loader. |
| modelAssetBuffer | Uint8Array \| ReadableStreamDefaultReader | A `Uint8Array` or `ReadableStreamDefaultReader` containing the `.litertlm` model bytes. |

**Returns:**

Promise\<AudioTranscriber\>

## AudioTranscriber.setOptions()

Sets the options for the `AudioTranscriber` and initializes the underlying engine. Options cannot be updated once the engine has been created.

**Signature:**

```typescript
setOptions(options: AudioTranscriberOptions): Promise<void>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| options | AudioTranscriberOptions | The options for the AudioTranscriber. |

**Returns:**

Promise\<void\>

## AudioTranscriber.transcribe()

Transcribes mono PCM float audio samples in `[-1.0, 1.0]`.

**Signature:**

```typescript
transcribe(audioSamples: Float32Array | number[], endOfStream?: boolean): Promise<AudioTranscriberResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| audioSamples | Float32Array \| number\[\] | Mono PCM float audio samples at `sampleRateHz`. |
| endOfStream | boolean | Whether this chunk marks the end of the audio stream. Defaults to `true` (unary single-utterance mode). |

**Returns:**

Promise\<AudioTranscriberResult\>

## AudioTranscriber.transcribeStream()

Feeds a streaming chunk of mono PCM float audio samples (`endOfStream = false`) and returns any newly emitted interim or final segments.

**Signature:**

```typescript
transcribeStream(audioSamples: Float32Array | number[]): Promise<AudioTranscriberResult>;
```

### Parameters

| Parameter | Type | Description |
|---|---|---|
| audioSamples | Float32Array \| number\[\] | Mono PCM float audio samples at `sampleRateHz`. |

**Returns:**

Promise\<AudioTranscriberResult\>

## AudioTranscriber.finishStream()

Flushes any remaining buffered audio and finalizes the current stream.

**Signature:**

```typescript
finishStream(): Promise<AudioTranscriberResult>;
```

**Returns:**

Promise\<AudioTranscriberResult\>

## AudioTranscriber.prewarm()

Prewarms the underlying inference engine to reduce first-chunk latency.

**Signature:**

```typescript
prewarm(): Promise<void>;
```

**Returns:**

Promise\<void\>

## AudioTranscriber.close()

Closes the `AudioTranscriber` and releases native engine and Wasm memory.

**Signature:**

```typescript
close(): void;
```

**Returns:**

void