[vorbis] Useful scripts for WAV encode/decode

Frank T. Lofaro Jr. ftlofaro at earthlink.net
Sat May 20 21:46:57 PDT 2000



First off, I'd like to say it appears you've got a very nice codec
written here.

Using the example decoder and encoder can be a bit inconvenient though,
since the encoder ignores the contents of the WAV header and the decoder
outputs raw PCM without any header.

For real world applications this is a big drawback. WAVs that aren't
44100 Hz 16 bit signed stereo get mangled on encode.  The output of the
decoder isn't recognizable or usable by most sound programs.

So I wrote some wrapper shell scripts to make it easier to convert WAV
<-> Vorbis

They take stdin as the first argument and stdout as the second. They
aren't extremely well tested,
consider them beta or example code themselves.

Here they are:

ogg_encode:

#! /bin/sh
if [ $# -gt 0 ]; then
    exec < $1
fi
if [ $# -gt 1  ]; then
    exec > $2
fi
sox - -t wav -c 2 -s -w -r 44100 - | encoder_example

ogg_decode:

#! /bin/sh
if [ $# -gt 0 ]; then
    exec < $1
fi
if [ $# -gt 1  ]; then
    exec > $2
fi
decoder_example | sox -t sw -c 2 -s -w -r 44100 - -t wav -s -w -r 44100
-

Hope these help. They work for me. They may (or may not) work for you.

--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'vorbis-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the Vorbis mailing list