RawAudio
A single block of an audio bitstream
Panel support
RawAudio is used in the Audio panel.
Schema
| field | type | description |
|---|---|---|
timestamp | Timestamp | Timestamp of the start of the audio block |
data | bytes | Raw audio data without WAV, container, or RTP headers. Samples must be interleaved. Multibyte samples must be little-endian. |
format | string | Format of the audio data. See the data field description for supported values. Consumers may support a subset of these formats. |
sample_rate | uint32 | Sample rate in Hz. This must be greater than zero. |
number_of_channels | uint32 | Number 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_channelsso 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_channelsso 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_channelsso the block contains complete sample frames.
Reference implementations
Foxglove messages are framework-agnostic, and can be implemented using any supported message encoding:
| encoding | schema |
|---|---|
| ROS 1 | foxglove_msgs/RawAudio |
| ROS 2 | foxglove_msgs/msg/RawAudio |
| JSON | foxglove.RawAudio |
| Protobuf | foxglove.RawAudio |
| FlatBuffers | foxglove.RawAudio |
| OMG IDL | foxglove::RawAudio |
You must use the schema names specified above for Foxglove to recognize the schema.