Skip to main content

RawAudio

A single block of an audio bitstream

Panel support​

RawAudio is used in the Audio panel.

Schema​

fieldtypedescription
timestampTimestampTimestamp of the start of the audio block
databytesRaw audio data without WAV, container, or RTP headers. Samples must be interleaved. Multibyte samples must be little-endian.
formatstringFormat of the audio data. See the data field description for supported values. Consumers may support a subset of these formats.
sample_rateuint32Sample rate in Hz. This must be greater than zero.
number_of_channelsuint32Number of channels in the audio block. This must be greater than zero.

data​

For each format value, the data field contains audio sample data serialized as follows:

  • pcm-s16:
    • Each sample is a signed 16-bit PCM value.
    • The byte length must be divisible by 2 * number_of_channels so the block contains complete sample frames.
  • g711-alaw:
    • Each byte is one G.711 A-law encoded sample.
    • The byte length must be divisible by number_of_channels so the block contains complete sample frames.
  • g711-ulaw:
    • Each byte is one G.711 mu-law encoded sample.
    • The byte length must be divisible by number_of_channels so the block contains complete sample frames.

Reference implementations​

Foxglove messages are framework-agnostic, and can be implemented using any supported message encoding:

encodingschema
ROS 1foxglove_msgs/RawAudio
ROS 2foxglove_msgs/msg/RawAudio
JSONfoxglove.RawAudio
Protobuffoxglove.RawAudio
FlatBuffersfoxglove.RawAudio
OMG IDLfoxglove::RawAudio

You must use the schema names specified above for Foxglove to recognize the schema.