<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L199-L340) |

Performs streaming and unary speech-to-text transcription.

    mp.tasks.audio.AudioTranscriber(
        handle: ctypes.c_void_p
    )

<br />

<br />

<br />

| ## Args ||
|---|---|
| `handle` | Opaque C pointer created by `MpAudioTranscriberCreate`. |

<br />

## Methods

### `close`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L326-L334)

    close() -> None

Closes the transcriber and releases native C++ resources.

### `create_from_model_path`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L238-L252)

    @classmethod
    create_from_model_path(
        model_path: str,
        delegate: https://developers.google.com/edge/api/mediapipe/python/mp/tasks/BaseOptions/Delegate = _BaseOptions.Delegate.CPU,
        sample_rate_hz: int = 16000
    ) -> 'AudioTranscriber'

Creates an AudioTranscriber from a `.litertlm` model path.

### `create_from_options`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L211-L236)

    @classmethod
    create_from_options(
        options: https://developers.google.com/edge/api/mediapipe/python/mp/tasks/audio/AudioTranscriberOptions
    ) -> 'AudioTranscriber'

Creates an AudioTranscriber instance from `AudioTranscriberOptions`.

### `finish_stream`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L291-L299)

    finish_stream() -> https://developers.google.com/edge/api/mediapipe/python/mp/tasks/audio/AudioTranscriberResult

Flushes any buffered audio and finalizes the current stream.

### `prewarm`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L254-L260)

    prewarm() -> None

Runs a dummy warm-up pass to initialize execution kernels.

### `transcribe`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L262-L289)

    transcribe(
        audio_samples: Union[Sequence[float], np.ndarray],
        end_of_stream: bool = True
    ) -> https://developers.google.com/edge/api/mediapipe/python/mp/tasks/audio/AudioTranscriberResult

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

<br />

<br />

<br />

| Args ||
|---|---|
| `audio_samples` | Sequence or 1D NumPy array of mono float32 PCM samples. |
| `end_of_stream` | Whether this audio chunk concludes the current stream. |

<br />

<br />

<br />

<br />

| Returns ||
|---|---|
| An `AudioTranscriberResult` containing recognized segments. ||

<br />

### `__enter__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L336-L337)

    __enter__() -> 'AudioTranscriber'

### `__exit__`

[View source](https://github.com/google-ai-edge/mediapipe/blob/master/mediapipe/tasks/python/audio/audio_transcriber.py#L339-L340)

    __exit__(
        exc_type, exc_val, exc_tb
    ) -> None