Re: [LAD] A question about audio file interfaces

From: Fred Gleason <fredg@email-addr-hidden>
Date: Sun Dec 01 2013 - 05:42:41 EET

On Nov 30, 2013, at 17:57 14, Fons Adriaensen <fons@email-addr-hidden> 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" |
|-------------------------------------------------------------------------|

_______________________________________________
Linux-audio-dev mailing list
Linux-audio-dev@email-addr-hidden
http://lists.linuxaudio.org/listinfo/linux-audio-dev
Received on Sun Dec 1 08:15:01 2013

This archive was generated by hypermail 2.1.8 : Sun Dec 01 2013 - 08:15:01 EET