soundkit

A package for working with low-latency audio via SRT and via HTTP Range requests

Audio Packet Header Encoding

This package provides encoding and decoding for audio packet headers. The header encoding is used to specify the details about the audio data that follows in the packet. This includes information about the encoding method, configuration parameters, and frame sizes for each channel.

Header Structure

The header structure is as follows:

|-----------------------------------------------------------------------------|
|    Flag + Config ID    |   Channel Count   |    Frame Size 1    |    ...    |
|-----------------------------------------------------------------------------|
|         1 Byte         |       1 Byte      |       2 Bytes      |    ...    |
|-----------------------------------------------------------------------------|

EncodingFlag

The EncodingFlag indicates the method of encoding used for the audio data. Currently, two encoding methods are supported:

AudioConfig

The AudioConfig is a enumeration that represents the sample rate and bit depth of the audio data. The following configurations are supported:

Each configuration indicates a combination of the sample rate (in Hz) and the bit depth (in Bits). For instance, Hz44100Bit16 represents a sample rate of 44100 Hz and a bit depth of 16 bits.