Skip to content

Interleaved PCM Audio

Melchor Garau Madrigal edited this page Feb 19, 2017 · 1 revision

First you must know how the audio is sampled and stored in files if you don't know yet.

Well, now the term interleaved means that all channel samples are stored together as a pack (call it sample). Every channel occupies bitsPerSample / 8 bytes, so every frame occupies bitsPerSample / 8 * channels bytes, and a raw audio file will be bitsPerSample / 8 * channels * totalSamples bytes. I hope this ASCII art could explain you that meaning:

channels = 2     bit depth = 16
 _________________________________________________
|    Sample 0   |    Sample 1   |     Sample 2    |  Frames
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 |  Bytes
|  Left | Right | Left  | Right | Left  |  Right  |  Channels
 -------------------------------------------------
channels = 5.1 (6)     bit depth = 24  (Channel order follows SMPTE/ITU)
 _______________________________________________________________________________
|                                   Sample 0                                    |  Frames
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |  Bytes
|    Left   |   Right   |  Center   |     LFE     |     LBack    |     RBack    |  Channels
 -------------------------------------------------------------------------------
Clone this wiki locally