OggVorbis player

Brad Fuller brad at sonaural.com
Thu Nov 10 17:35:21 UTC 2005


stéphane ducasse wrote:

> hi
>
> I wanted to know what is the status of the OggVorbis player since we 
> said that we would include it in the full version of
> 3.9 if it was ready.

Back in june of 2004, Russell Penney announced the beginning of his 
port. i don't know ithe current status. Here's the original msg:

-------- Original Message --------
Subject: [ANN] "Pure" Ogg-Vorbis decoder
Date: Fri, 11 Jun 2004 21:02:11 +1000
From: Russell Penney <russell.penney at tincanct.com>
Reply-To: The general-purpose Squeak developers list 
<squeak-dev at lists.squeakfoundation.org>
To: squeak-dev at lists.squeakfoundation.org


I have just released onto SqueakMap a “pure” Smalltalk port of the 
Ogg-Vorbis decoder from Xiph.

It is VERY slow, very buggy and the code is so ugly that it would 
definitely win the “Ugliest Code Competition”.
I have had a compulsion to write an Ogg decoder and so I took the 
hardest, slowest way I possibly could because I am lazy (confused? Me too).

I could have linked the libraries via a plugin and saved myself a huge 
amount of work, but I convinced myself that a “pure” codec would be so cool.

I think it is definitely useable after much refactoring and 
optimisation. I have very little experience in Smalltalk, I use it as a 
hobby and so my knowledge of the correct structure for code like the Ogg 
stuff is very limited.

I am not going to have much time to spend on the code for at least a 
month probably two so rather than the code gather dust, I thought I 
would put it out so I can get some suggestions on the best way of tiding 
up the code. Great learning experience for me.
The code is a mixture of the documented algorithm and the C code for the 
reference codec. It is missing many things (error checking being the 
main one) and will probably not decode all types of Ogg files.

I think Exceptions can be used for the error handling as sometimes 
reaching the end of a packet unexpectedly is fatal and sometimes its ok 
(you just return what you had decoded to that point). Is that right? Or 
is there something better (or more standard)?

There are a lot of loops; I guess you could say a lot of “passes” over 
the data to recover the audio. There is probably not a lot to be done to 
reduce the number of passes but a lot could be done to optimise each 
step individually. I must admit I only understand the algorithm a little 
bit and sections like the MDCT (Modified Discrete Cosine Transform) I 
have had to rip almost straight from the C code. I looked at the code 
for ages and could not figure out any way to make that code better/easy 
to understand. I don’t have enough of a maths background to understand 
the original equation for the transform and come up with a better way of 
doing it in Smalltalk.

Xiph released a version of OggVorbis called Tremour which is integer 
only (mainly for embedded devices). Would it be faster to modify the 
code to use integers only?

Obviously making sections of the code a plugin would be a good idea. One 
of reasons I wrote the whole thing in Smalltalk was so it would be easy 
to use Slang instead. I have left most of the loops as zero based and 
most ‘at:’ statements have “+1” added separately to make them easier to 
remove. I haven’t had the time to really get into Slang and plugins so 
any advice would be appreciated! :) What is the best class to subclass 
from? How do I do a plugin that doesn’t need any external code? For 
sections like the MDCT can I just put a huge chunk of C code in a 
method? How do I pass an array of floats?

I did try a little bit while I was coding but after my image crashed for 
the 10th time I gave up! :)

I have attached my test ogg file. You really want to try it on a small 
file as it is SLOW :)

Have fun

Russell




-- 
Brad Fuller
(408) 799-6124
** Sonaural Audio Studios **
(408) 799-6123  West San Jose
(408) 799-6124  Cambrian
________________________________
Hear us online: www.Sonaural.com
See me on O'Reilly: http://www.oreillynet.com/pub/au/2184




More information about the Squeak-dev mailing list