[vorbis-dev] advocacy and added options to ogg123

Graham Mitchell graham at grahammitchell.net
Tue Jan 8 20:39:44 PST 2002



Hey all.  Two topics:

First, I teach Computer Science at the high school level at a largish school 
near Austin, Texas.  For the past several years there's been a "jukebox" in 
my room where students could vote for albums to hear during programming lab 
time, and random tracks off the winning albums play over the speakers in the 
classroom.

This past week I changed the "player" portion of the system to play oggs 
instead of mp3s.  So I've spent the past two days explaining to each of my 
classes (over 100 students in CS-I, CS-II, and CS-III combined) about the 
changes in the system and why I moved from mp3s to Ogg Vorbis.

Why not mp3?
1) Quality is lower than many current alternatives.
2) Patent situation is scary and I fear a recurrence of the whole Unisys/GIF 
fiasco.
3) Saying I have a hard-drive full of mp3s just sounds shady, even when 
they're all legal.

And why Ogg Vorbis?
1) Sound quality vs. file size is very nice.  (I quoted for them that for 
similar quality, oggs are about 10% smaller. (-q 3 ogg vs 160Kbps mp3))
2) Patent-free algorithms and open-source mean The Man can never take my oggs 
from me.  Also makes it easy to add functionality.

Just wanted to share that over a hundred kids in the "Silicon Hills" just 
basically got a well-informed lecture on why they should switch to Ogg Vorbis.

And previously I'd had 128Kbps mp3s; I replaced them with (slightly smaller) 
-q 3 oggs and have already had a student or two remark about the improved 
sound quality.

Second topic, somewhat related:

In order to replace my previous mp3 player (was xaudio wrapped in a bit of 
custom code) with an ogg player, I needed to add a few options to ogg123, and 
wanted to offer my changes if anyone wants them.

First major change: added simplistic playlist support.  Now you can specify 
oggs/URLs or text files containing names of oggs/URLs (one per line) on the 
command line, and it will play all the files in order.  Deciding whether a 
given file is an ogg or a playlist is incredibly stupid at the moment (if it 
doesn't end in ".ogg", it's a playlist), but is abstracted enough to be 
easily replaced with a smarter heuristic.  This was the only "modification"; 
all the others are additions which could be safely ignored.

I also added three command-line parameters.

-D, --daemonize - runs the player in the background automatically.
        Also sets --quiet.  This addition was the reason for
        <A HREF="http://bugs.xiph.org/show_bug.cgi?id=116">bug 116</A>.

-S file, --status-file=file - writes the name/URL of the currently playing
        track to the given file.  Clears the file on quit.

-P file, --poll=file - reads the given playlist/file for tracks to play, but
        also stats it between each track to see if it has changed.  If so, it
        reads in the playlist again and starts over at the top.  If the
        playlist is empty or has been expended, the program doesn't quit but
        rather sleeps for ten seconds, and stats the playlist again every
        time it wakes up.  Using the parameter ignores any other
        files/URLs/playlist supplied on the command line; it *only* reads the
        list supplied with this parameter.  Useful for radio station type
        situations.

        This would theoretically work for a single ogg which it would play, and
        then sleep until the ogg file changed, when it would play it again.  I
        haven't tested this, but it should work and might be useful for some.

I run my new program as:
% ogg123d -P /music/metafile.m3u -S /var/run/now_playing -D

After the kids' votes are collated, the winning playlist is written to 
/music/metafile.m3u, and within ten seconds the player wakes up and starts 
playing tracks without any explicit user intervention.  As the tracks are 
played, it writes the names to /var/run/now_playing, which I have another 
daemon parse and display on a "Now Playing" screen.  When the list is 
expended, the player just quietly sleeps and waits for the playlist to change 
again.

The code is in the "works for me" category.  Download it at
        http://cs.leander.isd.tenet.edu/~mitchell/ogg123d-0.1.0.tar.gz

I only touched a couple of files, and all my code is wrapped with
/* Graham Mitchell added this code. */
        foo();
/* End of code added by Graham Mitchell. */

...mostly for my own sanity so I can remember which parts are mine if I want 
to add something else in six months.

If there's interest I can separate out the code for each of the changes 
individually and make four patches for the stock rc3 ogg123. (Assuming 
someone can tell me how to appropriately run 'diff'.)

Sorry for the long message.  I could probably have said all this in much 
fewer words, but I tend to ramble in emails sometimes.  Fortunately I don't 
ramble when coding.


-- 
Graham Mitchell - computer science teacher, Leander High School
"Come thou no more for ransom, gentle herald.  They shall have none, I
swear, but these my joints, which if they have as I will leave 'em them,
shall yield them little."                             - Henry the Fifth

--- >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-dev-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-dev mailing list