| Crates.io | steam-audio-codec |
| lib.rs | steam-audio-codec |
| version | 0.1.1 |
| created_at | 2025-05-05 17:28:59.52041+00 |
| updated_at | 2025-05-25 15:40:31.9864+00 |
| description | parser for steams voice packets |
| homepage | |
| repository | https://codeberg.org/demostf/steam-audio-codec |
| max_upload_size | |
| id | 1660992 |
| size | 37,136 |
Parser for steam's voice packets.
The "steam" audio codec is used by various voice chat application by steam and Source engine games.
The codec is a fairly thin wrapper around opus packets, so most of the heavy lifting is done by libopus
Voice data can be decoded with the following steps:
SteamVoiceDecoderSteamVoiceData from the raw binary data,
this will validate that the packet is valid and extract the steam id of the
account sending the voice from the header.SteamVoiceData into SteamVoiceDecoder::decode which will write
16-bit PCM samples to the provided output buffer.See the demo_voice example for a full example in the context of extracting voice chat from a TF2 demo.
Note: this section only applies when using the, enabled by default, "opus" feature.
As this crate uses libopus to do the actual audio decoding you'll need either
pkg-config and libopus (including development headers)or
cmake, make, and a C compiler to build libopus from scratch.See the audiopus_sys documentation for more information.
If you need more control over how the opus data is handled, you can disable the
builtin opus decoder by removing the (on by default) opus cargo feature.
When this feature is disabled, the SteamVoiceDecoder struct is not available.
You can instead access the sample rate, raw opus data and silence information in
the voice data from SteamVoiceData::packets.
The opus data should be decoded as mono sound with the sample rate encoded in the packets.