Re: [linux-audio-user] SAOL/MP4 question

New Message Reply About this list Date view Thread view Subject view Author view Other groups

Subject: Re: [linux-audio-user] SAOL/MP4 question
From: John Lazzaro (lazzaro_AT_CS.Berkeley.EDU)
Date: Thu Jul 04 2002 - 01:32:06 EEST


> Brian Redfern writes:
>
> As far as I know, those files are used by sfront to create a c program
> that then generates an mp4, but those files themselves are part of sfront,
> not mp4 itself.

Just to clarify here ...

The "mp4" files really do act as containers for these different files.
And so, you can place file types into, and also extract them out. An
example:

Let's look at the "sfront/examples/src1" example that ships with sfront.

% pwd
/home/cs/lazzaro/s81/examples/scr1
% ls
Makefile core/ samp_1.aif scr1.mid scr1.saol scr1.sasl

Let's make a (pseudo, since saolc and sfront pre-date true MPEG mp4 files)
mp4 file using sfront:

sfront -orc scr1.saol -sco scr1.sasl -midi scr1.mid -bitout scr1.mp4

% ls
Makefile core/ sa.c samp_1.aif scr1.mid scr1.mp4 scr1.saol scr1.sasl

This scr1.mp4 file is basically a binary encapsulation of the three
constituent files. The SAOL and SASL files are token-encoded, and
so the size goes down a bit, but the MIDI and AIF file are encoded
directly. We can see this by looking at all of the file sizes:

-rw-rw-r-- 1 lazzaro brass 14 May 24 17:52 scr1.sasl
-rw-rw-r-- 1 lazzaro brass 3752 May 24 17:52 scr1.saol
-rw-rw-r-- 1 lazzaro brass 11704 May 24 17:52 scr1.mid
-rw-rw-r-- 1 lazzaro brass 303754 May 24 17:52 samp_1.aif
-rw-rw-r-- 1 lazzaro brass 316847 Jul 3 15:21 scr1.mp4

We can extract these constituent files out by using this command:

sfront -bit scr1.mp4 -orcout tmp.saol -scoout tmp.sasl -midout tmp.mid

-rw-rw-r-- 1 lazzaro brass 303744 Jul 3 15:25 a41.wav
-rw-rw-r-- 1 lazzaro brass 17 Jul 3 15:25 tmp.sasl
-rw-rw-r-- 1 lazzaro brass 2694 Jul 3 15:25 tmp.saol
-rw-rw-r-- 1 lazzaro brass 11704 Jul 3 15:25 tmp.mid

Basically, a41.wav is a WAV file that has the same data as the
original samp_1.aif file. The semantics of the tmp.saol and the
tmp.sasl files match the semantics of scr1.saol and scr1.sasl,
but you might notice the tmp.saol is smaller -- by default, when
SAOL programs are encoded by sfront, the symbol table isn't saved,
so the variables lose their given names. If we look at the tmp.saol
file:

instr a4(a6,a7)preset 0 {
  ivar a8,a9,a10,a11,a12;
  ksig a13,a14,a15,a16,a17,a18;
[...]

We see machine-generated names a1, a2, etc, which take up less space.
But the programs themselves are identical. Note that when you made
the scr1.mp4 file, it was possible to include the symbol table, by
using the -symtab option. The mp4 file would be a little bigger, though.

This whole topic seems arcane, I know, but notice the important meta
issue behind it all -- when you send an mp4 file that is encoded
with Structured Audio, you're sending programs and data, not compressed
waveforms. So, it really is lossless, in the sense that the program
running on your machine and the program running on the receiver machine
should both produce the same audio stream, modulo issues like different
floating point representations, as long as:

  -- the two decoders both comply with the standard
  -- the SAOL stays away from the handful of "non-normative" opcodes
     in the standard (clearly labeled in the standard, and mostly in
     the book too).

-------------------------------------------------------------------------
John Lazzaro -- Research Specialist -- CS Division -- EECS -- UC Berkeley
lazzaro [at] cs [dot] berkeley [dot] edu www.cs.berkeley.edu/~lazzaro
-------------------------------------------------------------------------


New Message Reply About this list Date view Thread view Subject view Author view Other groups

This archive was generated by hypermail 2b28 : Thu Jul 04 2002 - 01:31:44 EEST