Skip to content

Generating transcriptions

Marvin can generate text from speech.

What it does

The transcribe function generates text from audio.


To generate a transcription, provide the path to an audio file:

import marvin

transcription = marvin.transcribe("fancy_computer.mp3")


assert transcription.text == "I sure like being inside this fancy computer."

How it works

Marvin passes your file to the OpenAI transcription API, which returns an transcript.

Async support

If you are using Marvin in an async environment, you can use transcribe_async:

result = await marvin.transcribe_async('fancy_computer.mp3')
assert result.text == "I sure like being inside this fancy computer."

Model parameters

You can pass parameters to the underlying API via the model_kwargs argument. These parameters are passed directly to the respective APIs, so you can use any supported parameter.