# Input

Learn about the supported input audio formats for the Speechmatics Realtime API

## Supported input audio formats[​](#supported-input-audio-formats "Direct link to Supported input audio formats")

Sessions can be configured to use two types of audio input: `file` and `raw`.<br /><!-- -->We recommend using the `raw` option, unless you have a specific reason to use the `file` option.

For capturing raw audio in the browser, try our [`browser-audio-input` package](https://www.npmjs.com/package/@speechmatics/browser-audio-input).

### `audio_format`[​](#audio_format "Direct link to audio_format")

The format must be supplied in the `audio_format` field of the `StartRecognition` message. See the [API reference](/api-ref/realtime-transcription-websocket.md#startrecognition).

oneOf

* Raw
* File

Raw audio samples, described by the following additional mandatory fields:

**type**required

Constant value: `raw`

**encoding**stringrequired

Possible values: \[`pcm_f32le`, `pcm_s16le`, `mulaw`]

**sample\_rate**integerrequired

The sample rate of the audio in Hz.

**Example**: `{"type":"raw","encoding":"pcm_s16le","sample_rate":44100}`

Choose this option to send audio encoded in a recognized format. The AddAudio messages have to provide all the file contents, including any headers. The file is usually not accepted all at once, but segmented into reasonably sized messages.

Note: Only the following formats are supported: `wav`, `mp3`, `aac`, `ogg`, `mpeg`, `amr`, `m4a`, `mp4`, `flac`

**type**required

Constant value: `file`

## Sending audio[​](#sending-audio "Direct link to Sending audio")

After receiving a `RecognitionStarted` message, you can start sending audio over the Websocket connection. Audio is sent as binary data, encoded in the format specified in the `StartRecognition` message. See [Protocol overview](/api-ref/realtime-transcription-websocket.md#protocol-overview) for complete details of the API protocol.

## Next steps[​](#next-steps "Direct link to Next steps")

View our guides:

* [using a microphone](/speech-to-text/realtime/guides/python-using-microphone.md) to learn how to capture audio from a microphone.
* [using FFMPEG](/speech-to-text/realtime/guides/python-using-ffmpeg.md) to find out how to pipe microphone audio to the API.
