<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<meta name=Generator content="Microsoft Word 11 (filtered medium)">
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:Arial;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 90.0pt 72.0pt 90.0pt;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>I have just released onto SqueakMap a
&#8220;pure&#8221; Smalltalk port of the Ogg-Vorbis decoder from Xiph.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>It is VERY slow, very buggy and the code is so ugly
that it would definitely win the &#8220;Ugliest Code Competition&#8221;.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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).<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>I could have linked the libraries via a plugin and
saved myself a huge amount of work, but I convinced myself that a
&#8220;pure&#8221; codec would be so cool.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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. <o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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)?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>There are a lot of loops; I guess you could say a lot
of &#8220;passes&#8221; 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&#8217;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.<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>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 &#8216;at:&#8217; statements have &#8220;+1&#8221; added separately to
make them easier to remove. I haven&#8217;t had the time to really get into
Slang and plugins so any advice would be appreciated! :)&nbsp; What is the best
class to subclass from? How do I do a plugin that doesn&#8217;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?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>I did try a little bit while I was coding but after
my image crashed for the 10<sup>th</sup> time I gave up! :)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>I have attached my test ogg file. You really want to
try it on a small file as it is SLOW :)<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>Have fun<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span lang=EN-AU style='font-size:
10.0pt;font-family:Arial'>Russell<o:p></o:p></span></font></p>

</div>

</body>

</html>