[LAD] A question about audio file interfaces

Fred Gleason fredg at paravelsystems.com
Sun Dec 1 03:42:41 UTC 2013


On Nov 30, 2013, at 17:57 14, Fons Adriaensen <fons at linuxaudio.org> wrote:

> In view of this, what is currently the best way for an
> app to read/write audio files, the basic read() and write()
> calls, or the stdio interface ?

A lot depends on specifics —e.g. what underlying format you are addressing, read-only vs write-only vs read-write and the granularity of seeks required.  For PCM formats, things are relatively easy — individual frames can be directly accessed and buffered.  Where it gets tricky is with non-linear encodings —e.g. MPEG or Vorbis— where a single ‘frame' of encoded audio corresponds to multiple frames of PCM.  Even with relatively ‘simple’ MPEG formats (such as CBR Layer 2), trying to support PCM seek granularities less than the encoded PCM frame size requires some fairly sophisticated blocking and buffering routines. Layer 3 can be much more difficult, primarily because it permits unused space in one frame to be used to carry overflow bits from another (the so-called ‘bit reservoir’), thus potentially making the decoded value of a particular PCM frame dependent upon upon the contents of *multiple* MPEG frames.

Cheers!


|-------------------------------------------------------------------------|
| Frederick F. Gleason, Jr. |               Chief Developer               |
|                           |               Paravel Systems               |
|-------------------------------------------------------------------------|
| But in our enthusiasm, we could not resist a radical overhaul of the    |
| system, in which all of its major weaknesses have been exposed,         |
| analyzed, and replaced with new weaknesses.                             |
|                         -- Bruce Leverett                               |
|                        "Register Allocation in Optimizing Compilers"    |
|-------------------------------------------------------------------------|



More information about the Linux-audio-dev mailing list