[][src]Module libpulse_binding::sample

Constants and routines for sample type handling.

Overview

PulseAudio is capable of handling a multitude of sample formats, rates and channels, transparently converting and mixing them as needed.

Sample Formats

PulseAudio supports the following sample formats:

  • U8 - Unsigned 8 bit integer PCM.
  • S16LE - Signed 16 integer bit PCM, little endian.
  • S16BE - Signed 16 integer bit PCM, big endian.
  • FLOAT32LE - 32 bit IEEE floating point PCM, little endian.
  • FLOAT32BE - 32 bit IEEE floating point PCM, big endian.
  • ALAW - 8 bit a-Law.
  • ULAW - 8 bit mu-Law.
  • S32LE - Signed 32 bit integer PCM, little endian.
  • S32BE - Signed 32 bit integer PCM, big endian.
  • S24LE - Signed 24 bit integer PCM packed, little endian.
  • S24BE - Signed 24 bit integer PCM packed, big endian.
  • S24_32LE - Signed 24 bit integer PCM in LSB of 32 bit words, little endian.
  • S24_32BE - Signed 24 bit integer PCM in LSB of 32 bit words, big endian.

The floating point sample formats have the range from -1.0 to 1.0.

Sample Rates

PulseAudio supports any sample rate between 1 Hz and 192000 Hz. There is no point trying to exceed the sample rate of the output device though as the signal will only get downsampled, consuming CPU on the machine running the server.

Channels

PulseAudio supports up to 32 individual channels. The order of the channels is up to the application, but they must be continuous. To map channels to speakers, see channelmap.

Calculations

The PulseAudio library contains a number of convenience functions to do calculations on sample formats:

Structs

Spec

A sample format and attribute specification.

Enums

Format

Sample format

Constants

CHANNELS_MAX

Maximum number of allowed channels.

RATE_MAX

Maximum allowed sample rate.

SAMPLE_FLOAT32

A Shortcut for SAMPLE_FLOAT32NE.

SAMPLE_FLOAT32NE

32 Bit IEEE floating point, native endian.

SAMPLE_FLOAT32RE

32 Bit IEEE floating point, reverse endian.

SAMPLE_S16NE

Signed 16 Bit PCM, native endian.

SAMPLE_S16RE

Signed 16 Bit PCM, reverse endian.

SAMPLE_S24NE

Signed 24 Bit PCM packed, native endian.

SAMPLE_S24RE

Signed 24 Bit PCM, packed reverse endian.

SAMPLE_S24_32NE

Signed 24 Bit PCM in LSB of 32 Bit words, native endian.

SAMPLE_S24_32RE

Signed 24 Bit PCM, in LSB of 32 Bit words, reverse endian.

SAMPLE_S32NE

Signed 32 Bit PCM, native endian.

SAMPLE_S32RE

Signed 32 Bit PCM, reverse endian.

Functions

bytes_print

Pretty print a byte size value (i.e. “2.5 MiB”).

channels_are_valid

Checks if the channel count is within the supported range.

format_is_valid

Checks if the given integer is a valid sample format.

rate_is_valid

Checks if the rate is within the supported range.