<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><atom:link href="http://claudiusmaximus.goto10.org/cm/rss20.xml" rel="self" type="application/rss+xml"/><title>ClaudiusMaximus</title><link>http://claudiusmaximus.goto10.org/cm/</link><description>ClaudiusMaximus news feed</description><item><title>Bowntz</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><img src="2010-03-12_bowntz.png" alt="Bowntz"/></p>
<p>Bowntz is a little world of colliding circles, implemented in Haskell
using OpenGL for video and SuperCollider3 for audio.
Its simulation algorithm is based on directly calculating the time until
the next collision rather than stepping through time at a constant rate.</p>
<p><a href="http://gitorious.org/bowntz" title="Bowntz (Gitorious)">Bowntz source code repository at Gitorious</a></p>
<blockquote><pre>git clone git://gitorious.org/bowntz/bowntz.git</pre></blockquote>
<p><a href="http://claudiusmaximus.goto10.org/v/bowntz/bowntz-demo-1.ogv" title="Bowntz (demo 1)">Bowntz (demo 1) video</a></p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2010-03-12_bowntz.html</link><guid>http://claudiusmaximus.goto10.org/cm/2010-03-12_bowntz.html</guid><pubDate>12 Mar 2010 03:13:23 GMT</pubDate><category>haskell</category><category>sc3</category></item><item><title>Konstrukt 2</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="../g/compass/konstrukt/konstrukt2.svg" title="Konstrukt 2"><img src="2010-02-28_konstrukt_2.png" alt="Konstrukt 2"/></a></p>
<p>Konstrukt is an SVG + ECMAScript application for
<a href="http://en.wikipedia.org/wiki/Compass_and_straightedge_constructions" title="Compass and straightedge constructions (wiki)">compass and straightedge construction</a>.
It's not too unintuitive to use, once you know what the controls are:</p>
<dl>
<dt>to draw a straight line through two marked points</dt><dd>press the <strong>v</strong> key and click on the two points</dd>
<dt>to draw a circle centered at one marked point through another</dt><dd>press the <strong>c</strong> key and click on the two points (the first of which is the center)</dd>
<dt>to delete a marked point and all edges through it</dt><dd>press the <strong>x</strong> key and click on the point (tip: you might create extra lines and circles for the purposes of deleting at an intersection)</dd>
<dt>to move the viewpoint</dt><dd>click on empty space to center the view on that position</dd>
<dt>to zoom in</dt><dd>press the <strong>PgUp</strong> key</dd>
<dt>to zoom out</dt><dd>press the <strong>PgDn</strong> key</dd>
</dl>
<p>New in Konstrukt version 2 are some more attractive drawing tools that are locked to the construction points, useful perhaps for mathematical diagrams like the above <em>3 octahedra around a line in a 24-cell</em>:</p>
<dl>
<dt>to draw a line segment between two marked points</dt><dd>press the <strong>s</strong> key and click on the two end points</dd>
<dt>to change the line segment thickness</dt><dd>press the <strong>-</strong> key or the <strong>+</strong> key</dd>
<dt>to draw a filled polygon</dt><dd>press the <strong>f</strong> key and click on as many points as you like, then press the <strong>z</strong> key</dd>
<dt>to change the fill colour for future polygons</dt><dd>press the <strong>[</strong> key or the <strong>]</strong> key</dd>
</dl>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2010-02-28_konstrukt_2.html</link><guid>http://claudiusmaximus.goto10.org/cm/2010-02-28_konstrukt_2.html</guid><pubDate>28 Feb 2010 21:31:41 GMT</pubDate><category>graphics</category><category>web</category></item><item><title>GDS Expo</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>I'm playing tonight at Goldsmiths Digital Studio Expo.</p>
<p>Cut and paste info follows:</p>
<blockquote>
<p>FREE ENTRY - OPEN DAY // Ben Pimlott Building, Goldsmiths, University of London, New Cross SE14 6NW</p>
<p>LIVE PERFORMANCES FROM 6:30pm //
programmed by TOPLAP and noise=noise //
livecoding - diy punk electronics - corrosive sound - hyperspace techno</p>
<ul>
<li><a href="http://www.utterpsalm.com/" title="John Wall">John Wall</a></li>
<li><a href="http://www.pawfal.org/dave/" title="Dave Griffiths">Dave Griffiths</a></li>
<li><a href="http://claudiusmaximus.goto10.org/cm/" title="ClaudiusMaximus">ClaudiusMaximus</a></li>
<li>Jamie Forth</li>
<li><a href="http://myspace.com/renderplant" title="Renderplant">Renderplant</a></li>
<li><a href="http://www.informatics.sussex.ac.uk/users/nc81/index.html" title="Sick Lincoln">Sick Lincoln</a></li>
<li><a href="http://yaxu.org/" title="Alex McLean">Alex McLean</a></li>
<li><a href="http://ryanjordan.org/" title="Hylics">Hylics</a></li>
</ul>
<p>There's also an <a href="http://www.gold.ac.uk/computing/news/eventtitle,18242,en.php" title="GDS Expo Exhibition">exhibition</a> running from 2pm.</p>
</blockquote>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2010-02-17_gds_expo.html</link><guid>http://claudiusmaximus.goto10.org/cm/2010-02-17_gds_expo.html</guid><pubDate>17 Feb 2010 13:33:00 GMT</pubDate><category>event</category></item><item><title>buildtorrent-0.8 released</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><strong>buildtorrent</strong> is a simple command-line .torrent file creation tool.</p>
<p>buildtorrent 0.8 (2010-01-31) comfy chair</p>
<p>Changes since <a href="2008-04-13_buildtorrent-0.7_released.html" title="buildtorrent 0.7">buildtorrent 0.7</a> (2008-04-13):</p>
<p>Fixed bugs:</p>
<ul>
<li>announce-list segfault on 64bit</li>
</ul>
<p>New features:</p>
<ul>
<li>webseed url-list (-w)</li>
<li>piece length as a power of 2 (-L)</li>
<li>torrent name (-n)</li>
<li>external file list (-f)</li>
</ul>
<p>New homepage:</p>
<ul>
<li><a href="http://claudiusmaximus.goto10.org/cm/torrent.html" title="buildtorrent news">http://claudiusmaximus.goto10.org/cm/torrent.html</a></li>
</ul>
<p>New repository:</p>
<ul>
<li><a href="http://gitorious.org/buildtorrent" title="buildtorrent code">http://gitorious.org/buildtorrent</a></li>
</ul>
<p>The transition from 0.7 to 0.8 involved some extensive code
reorganisation to make it possible to add the new features:
as with any such extensive change, this may have introduced
new bugs.  If you find a bug, please report it.</p>
<p>Download the release tarball: <a href="http://claudiusmaximus.goto10.org/files/coding/buildtorrent/buildtorrent-0.8.tar.gz" title="buildtorrent-0.8.tar.gz">buildtorrent-0.8.tar.gz</a></p>
<p>Checksums:</p>
<blockquote><pre>
3bba072cc89d2b8b4198c85734e39302 *buildtorrent-0.8.tar.gz
32694478ddef91453dc85ab7a2e659132adadeb6 *buildtorrent-0.8.tar.gz
</pre></blockquote>
<p>Manual page:</p>
<blockquote>
<h4>Synopsis</h4>
<p><strong>buildtorrent</strong> [<em>OPTIONS</em>] <em>-a announceurl input output</em></p>
<p><strong>buildtorrent</strong> [<em>OPTIONS</em>] <em>-a announceurl -f filelist -n name output</em></p>
<h4>Description</h4>
<p><strong>buildtorrent</strong> is a torrent file creation program. Given an
announce url and an input file or directory, <strong>buildtorrent</strong>
generates an output <em>.torrent</em> file that can be used by
torrent clients.</p>
<h4>Options</h4>
<dl>
<dt><strong>-a</strong> <em>announce</em>, <strong>--announce=</strong><em>url</em></dt>
<dd>Announce URL (required).</dd>
<dt><strong>-f</strong> <em>filelist</em>, <strong>--filelist=</strong><em>filelist</em></dt>
<dd><p>A text file (or - for standard input) containing a list of files to
add to the output torrent file, together with the path to use inside the
torrent.  One file is given per line, use / as path separator for the
torrent path, use | to separate the filesystem path from the torrent
path.  Backslash \ can be used to escape newlines and | characters inside
names.  For example:</p>
<blockquote><pre>/data/files/linux.iso|bin/linux.iso
/data/files/linux.txt|doc/linux.txt</pre></blockquote>
<p>Using this option requires that the <em>--name</em> option be used.</p></dd>
<dt><strong>-n</strong> <em>name</em>, <strong>--name=</strong><em>name</em></dt>
<dd>Specify  the  name  for  the  torrent.   Usage of this option is
required when the <em>--filelist</em> option is used, in  which case it
specifies  the  name  of the torrent directory.  Usage without a
file list overrides the name of the directory or file  given  on
the command line.</dd>
<dt><strong>-A</strong> <em>announces</em>, <strong>--announcelist=</strong><em>announces</em></dt>
<dd><p>Additional announce URL list.   Use , to separate outer level
lists, and | to separate inner level items; for example:</p>
<blockquote><pre>a,b1|b2,c</pre></blockquote></dd>
<dt><strong>-w</strong> <em>webseeds</em>, <strong>--webseeds=</strong><em>webseeds</em></dt>
<dd><p>Additional WebSeed URL list.   Use , to separate items; for example:</p>
<blockquote><pre>a,b,c</pre></blockquote></dd>
<dt><strong>-l</strong> <em>length</em>, <strong>--piecelength=</strong><em>length</em></dt>
<dd>Piece length in bytes (default 262144).</dd>
<dt><strong>-L</strong> <em>size</em>, <strong>--piecesize=</strong><em>size</em></dt>
<dd>Use 2<sup><em>size</em></sup> as piece length in bytes (default 18) (overrides <em>-l</em>).</dd>
<dt><strong>-c</strong> <em>comment</em>, <strong>--comment=</strong><em>comment</em></dt>
<dd>User comment (omitted by default).</dd>
<dt><strong>-p</strong> <em>private</em>, <strong>--private=</strong><em>private</em></dt>
<dd>Private flag (either 0 or 1).</dd>
<dt><strong>-D</strong>, <strong>--nodate</strong></dt>
<dd>Omit the <em>creation date</em> field.</dd>
<dt><strong>-C</strong>, <strong>--nocreator</strong></dt>
<dd>Omit the <em>created by</em> field.</dd>
<dt><strong>-m</strong>, <strong>--md5sum</strong></dt>
<dd>Add an <em>md5sum</em> field for each file.</dd>
<dt><strong>-s</strong>, <strong>--show</strong></dt>
<dd>Show generated torrent structure.</dd>
<dt><strong>-S</strong>, <strong>--showall</strong></dt>
<dd>Show generated torrent structure, including piece data.</dd>
<dt><strong>-q</strong>, <strong>--quiet</strong></dt>
<dd>Quiet operation with reduced output.</dd>
<dt><strong>-V</strong>, <strong>--version</strong></dt>
<dd>Show the version string.</dd>
<dt><strong>-h</strong>, <strong>--help</strong></dt>
<dd>Show a help screen with brief usage information.</dd>
</dl>
<h4>See also</h4>
<ul>
<li><a href="http://www.createtorrent.com">createtorrent</a></li>
<li><a href="http://mktorrent.sourceforge.net">mktorrent</a></li>
<li><a href="http://wiki.theory.org/BitTorrentSpecification">http://wiki.theory.org/BitTorrentSpecification</a></li>
<li><a href="http://bittorrent.org/beps/bep_0012.html">http://bittorrent.org/beps/bep_0012.html</a></li>
<li><a href="http://www.getright.com/seedtorrent.html">http://www.getright.com/seedtorrent.html</a></li>
</ul>
</blockquote>
<p>Feature comparison matrix:</p>
<table>
<tr><th/><th>buildtorrent-0.8</th><th>mktorrent-1.0</th></tr>
<tr><th>announce url</th><td>Y</td><td>Y</td></tr>
<tr><th>announce list</th><td>Y</td><td>Y</td></tr>
<tr><th>webseed list</th><td>Y</td><td>Y</td></tr>
<tr><th>piece length</th><td>any</td><td>2<sup>N</sup></td></tr>
<tr><th>name</th><td>Y</td><td>Y</td></tr>
<tr><th>output file</th><td>Y</td><td>Y, implicit</td></tr>
<tr><th>comment</th><td>Y</td><td>Y</td></tr>
<tr><th>private</th><td>N/A,Y,N</td><td>N/A,Y</td></tr>
<tr><th>no date</th><td>Y</td><td>Y</td></tr>
<tr><th>no creator</th><td>Y</td><td>N</td></tr>
<tr><th>md5sum</th><td>Y</td><td>N</td></tr>
<tr><th>file list</th><td><strong>Y</strong></td><td><strong>N</strong></td></tr>
<tr><th>threads</th><td><strong>N</strong></td><td><strong>Y</strong></td></tr>
</table>
<p>buildtorrent is more flexible, especially with the external file list feature,
but mktorrent's threaded hashing wins if you want to exploit multi-core CPUs.</p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2010-01-31_buildtorrent-0.8_released.html</link><guid>http://claudiusmaximus.goto10.org/cm/2010-01-31_buildtorrent-0.8_released.html</guid><pubDate>31 Jan 2010 11:30:00 GMT</pubDate><category>torrent</category></item><item><title>MarkIII Demos</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="http://www.archive.org/details/ClaudiusMaximus_-_MarkIII_Demos" title="MarkIII Demos"><img src="2010-01-28_markiii_demos.png" alt="MarkIII Demos"/></a></p>
<p>Some work in progress demos of an audio-visual performance under development.
<em>MarkIII</em> is named after the 3rd-order
<a href="http://en.wikipedia.org/wiki/Markov_chain" title="Markov chain (wiki)">Markov chains</a>
it uses to generate sequences of sounds.</p>
<p>Demo 1 is the first proof of concept - sequences of harmonics of a simple tone.</p>
<p>Demo 2 extendes this to sequences of rhythms as well as harmonics of more complex tones.</p>
<p>Demo 3 returns to simple harmonics, but adds visualisation of the Markov Chains in 3D Euclidean space.</p>
<p>Demo 4 is a live recording of the same setup, filmed with a digital camera.</p>
<p>Demo 5 adds more complex organ-based sound, while also changing the visualisation to follow one point in rotations of a 3-sphere in 4D space.</p>
<p>Demo 6 follows two points in a minor scale in this 3-sphere.</p>
<p>Demo 7 improves the rotation algorithm but still suffers from gimbal lock.</p>
<p>Demo 8 adds additional voices and further rotation and colour tweaks.</p>
<p>Demo 9 has a completely new and improved rotation algorithm, however it still rotates the "long way" sometimes and some numerical instability at times.</p>
<p>MarkIII Demos were made with Pure-data using the PdLua, Gem and Zexy libraries.</p>
<p>The source code is available under GNU GPL3+ license, but is still changing rapidly and is unfinished and undocumented:</p>
<blockquote><pre>svn co https://code.goto10.org/svn/maximus/2010/markiii</pre></blockquote>
<p>Downloads:</p>
<table class="downloads">
<tr><th/><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th><th>6</th><th>7</th><th>8</th><th>9</th></tr>
<tr><th>higher quality</th>
<td>n/a</td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_2.flac">33MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_3.mpeg">84MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_4.avi">44MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_5.mpeg">84MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_6.mpeg">135MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_7.mpeg">72MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_8.mpeg">71MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_9.mpeg">67MB</a></td>
</tr>
<tr><th>smaller size</th>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_1.ogg">8MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_2.ogg">5MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_3.ogv">10MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_4.ogv">13MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_5.ogv">10MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_6.ogv">14MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_7.ogv">7MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_8.ogv">9MB</a></td>
<td><a href="http://www.archive.org/download/ClaudiusMaximus_-_MarkIII_Demos/ClaudiusMaximus_-_MarkIII_Demo_9.ogv">7MB</a></td>
</tr>
</table>
<p>More download options available at the <a href="http://www.archive.org/details/ClaudiusMaximus_-_MarkIII_Demos" title="MarkIII Demos">MarkIII Demos Internet Archive page</a>.</p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2010-01-28_markiii_demos.html</link><guid>http://claudiusmaximus.goto10.org/cm/2010-01-28_markiii_demos.html</guid><pubDate>28 Jan 2010 19:20:21 GMT</pubDate><category>hyperspace</category><category>lua</category><category>music</category><category>pd</category><category>video</category></item><item><title>Temple</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="http://www.archive.org/details/ClaudiusMaximus_-_Temple" title="Temple"><img src="2010-01-10_temple.jpg" alt="Temple"/></a></p>
<p>brain massage generative music video // fractal video made with <a href="2009-09-24_fl4m6e_in_haskell.html" title="Fl4m6e in Haskell">Fl4m6e</a> // organic audio made with Pure-data using GridFlow and Zexy</p>
<p>Downloads:</p>
<ul class="downloads">
<li><a href="http://www.archive.org/download/ClaudiusMaximus_-_Temple/ClaudiusMaximus_-_Temple.mpeg" title="Temple (DVD)">DVD</a> (287MB)</li>
<li><a href="http://www.archive.org/download/ClaudiusMaximus_-_Temple/ClaudiusMaximus_-_Temple.ogv" title="Temple (Ogg)">Ogg</a> (24MB)</li>
<li><a href="http://www.archive.org/download/ClaudiusMaximus_-_Temple/ClaudiusMaximus_-_Temple_512kb.mp4" title="Temple (MPEG4)">MPEG4</a> (21MB)</li>
</ul>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2010-01-10_temple.html</link><guid>http://claudiusmaximus.goto10.org/cm/2010-01-10_temple.html</guid><pubDate>10 Jan 2010 22:00:00 GMT</pubDate><category>fractal</category><category>haskell</category><category>pd</category><category>video</category></item><item><title>Heist: busted!</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><img src="2009-12-06_heist_busted.png" alt="Heist: busted!"/></p>
<p>FAuSt has a nifty n-ary block diagram parallel composition operator, in which
you give it a count and a function from numbers to block diagrams.  Something
with the same meaning as:</p>
<blockquote><pre>parallel n f = foldr1 Par (map f [0..(n-1)])</pre></blockquote>
<p>If only life were so simple: that won't compile, because of my decision in
<a href="2009-12-04_heist_dataflow_algebra.html" title="Heist: dataflow algebra">Heist</a>
to express the type system of block diagram algebra within Haskell's type system.
So after about 4 hours of head scratching, I finally figured out how to
generalize from this:</p>
<blockquote><pre>par0 f = empty
par1 f = par0 f `Par` f 0
par2 f = par1 f `Par` f 1
par3 f = par2 f `Par` f 2
par4 f = par3 f `Par` f 3
...</pre></blockquote>
<p>to the point where this compiles successfully:</p>
<blockquote><pre>import Types.Data.Num.Decimal (d2, d4)
import Heist (Bd (Seq), parallel, add)
import Dot (toDot)

main = putStrLn(toDot(

    parallel d4 (const add) `Seq`
    parallel d2 (const add) `Seq`
    add

  ))</pre></blockquote>
<p>Check out the code to see the horrible gory details, where at the time
of writing (Subversion revision 1582) the relevant excerpt is lines
222-256 of Heist.hs:</p>
<blockquote><pre>svn co https://code.goto10.org/svn/maximus/2009/heist heist</pre></blockquote>
<p>At this point I was happy and delighted, but not for long.  I tried to
compile a program containing <em>parallel d8 add</em> and waited, and waited,
only to find (7.5 minutes later...) that GHC reached my operating system's
limit of 3GB per process and gave up.  It was a similar story when explicitly
limiting the heap size.  I ran some tests and it seemed that the compilation
time grew exponentially with the parallel count.</p>
<p>The "shortcut" of embedding FAuSt semantics inside Haskell to avoid
having to write a parser and type checker and all the rest turned out to be
a rather more "scenic route" through type level programming, but in summary:
theoretically beautiful, epic fail in practice.</p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2009-12-06_heist_busted.html</link><guid>http://claudiusmaximus.goto10.org/cm/2009-12-06_heist_busted.html</guid><pubDate>06 Dec 2009 02:00:00 GMT</pubDate><category>haskell</category></item><item><title>Heist: dataflow algebra</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><img src="2009-12-04_heist_dataflow_algebra.png" alt="Heist: dataflow algebra"/></p>
<p>So I was playing around with
<a href="http://faust.grame.fr/" title="FAuSt">FAuSt</a>,
a pure functional dataflow language for audio stream processing.  At first I
thought it was great, but then the compiler bugs bit hard: declaring two variables
with the same name in the same scope made the compiler segfault [2010-01-13 update: I have
not been able to reproduce this crash, so I'm probably wrong about the cause], and for some
reason it thought the index variables in my parallel constructs were duplicates
too.  I was trying to build a 16x16 matrix multiplication to implement my
favourite reverb... perhaps too ambitious?  Simple things are very concise
in FAuSt, though: I implemented Pure-data's <strong>vcf~</strong> in roughly
the same number of characters as the number of lines of code that the C
implementation had:</p>
<blockquote><pre>vcf(q,f,x) = w ~ (_,_) with {
  a = max(f * 2 * PI / SR, 0);
  r = max(1 - a / q, 0);
  c = r * cos(a);
  s = r * sin(a);
  k = (2 - 2 / (q + 2)) * (1 - r);
  w(u,v) = (k * x + c * u - s * v) , (s * u + c * v);
};</pre></blockquote>
<p>So I thought to myself, with Haskell's awesomeness I should be able to
embed the core of the FAuSt block diagram algebra semantics in a typesafe way.
Much headsploding followed, figuring out how to bluff my way through type-level
programming, until I managed to express the preconditions and results of each
of the five block diagram composition operators.</p>
<p>It might help to know what a block diagram is and how they can be composed.
For that I recommend Chapter 3 of
<a href="ftp://ftp.grame.fr/pub/Documents/faust_tutorial.pdf" title="A FAuSt Tutorial">A FAuSt Tutorial (PDF)</a>.
I decided that GADTs were what I needed, with constructors for each of the
composition operators, and one for primitives:</p>
<blockquote><pre><strong>-- abstract block diagrams</strong>
data Bd t where
  Rec   :: (...) =&gt; Bd i -&gt; Bd j -&gt; Bd k
  Par   :: (...) =&gt; Bd i -&gt; Bd j -&gt; Bd k
  Seq   :: (...) =&gt; Bd i -&gt; Bd j -&gt; Bd k
  Split :: (...) =&gt; Bd i -&gt; Bd j -&gt; Bd k
  Merge :: (...) =&gt; Bd i -&gt; Bd j -&gt; Bd k
  Prim  :: (...) =&gt; String  -&gt; k -&gt; Bd k
</pre></blockquote>
<p>I've omitted the contexts here, because they are quite long, expressing the
necessary preconditions on the shapes of the block diagram inputs and the resulting
output block diagram shape.  I'm using "shape" to mean a pair of type-level lists,
for example a standard <em>(+) :: Float -&gt; Float -&gt; Float</em> operator lifted
to a block diagram could have a shape like <em>(Float :. Float :. Nil, Float :. Nil)</em>,
depending on how spicy you like your curry.</p>
<p>FAuSt semantics for the recursive composition operator <em>A~B</em> are described
informally like this (where (i|o)X is the number of inputs|outputs of X):</p>
<ul>
<li>the first iB outputs of A are fed into the inputs of B</li>
<li>the outputs of B are fed into the first oB inputs of A</li>
<li>the remaining iA-oB inputs of A are the inputs of A~B</li>
<li>the oA outputs of A are the outputs of A~B</li>
</ul>
<p>From this description it's easy to see the requirement that oA&gt;=iB and iA&gt;=oB,
moreover the types of the inputs must match the types of the outputs they are connected
to.  This precondition on the compatibility of the shapes, and the shape of their
composition, can be expressed like this:</p>
<blockquote><pre><strong>-- recursive composition compatibility and result shape</strong>
type family IsRecCompat x y
type instance IsRecCompat (xi, xo) (yi, yo) = (Take (Length yi) xo `Equals` yi) :&amp;&amp;: (Take (Length yo) xi `Equals` yo)
type family RecShape x y
type instance RecShape (xi, xo) (yi, yo) = (Drop (Length yo) xi, xo)</pre></blockquote>
<p>Here <em>Take</em>, <em>Drop</em>, <em>Length</em>, and <em>Equals</em> operate on
type-level lists.  The full type of the Rec constructor is now:</p>
<blockquote><pre><strong>  -- recursive composition constructor</strong>
  Rec   :: (NaturalT (Length ai), NaturalT (Length ao),
            NaturalT (Length bi), NaturalT (Length bo),
            NaturalT (Length ci), NaturalT (Length co),
            i ~ (ai,ao), j ~ (bi,bo), k ~ (ci,co),
            IsRecCompat   i j ~ True, RecShape   i j ~ k)
        =&gt; Bd i -&gt; Bd j -&gt; Bd k</pre></blockquote>
<p>where the first 4 lines express that the lengths of the lists are non-negative
numbers and that the shapes are pairs of lists - not sure how to simplify this
boilerplate which is present for all the operators, but it seems to work ok.</p>
<p>With the fixities as in FAuSt...</p>
<blockquote><pre>infixl 4 `Rec`
infixl 3 `Par`
infixl 2 `Seq`
infixl 1 `Split`
infixl 1 `Merge`</pre></blockquote>
<p>...and suitable definitions of primitives, it's possible to write expressions
that look like a more verbose FAuSt, and manipulate them in various ways:</p>
<blockquote><pre><strong>-- example</strong>
main = putStrLn (toDot(
  castF `Par` castF
  `Split`
  ( addF `Par` subF `Par` mulF
     `Split`
     (addF `Par` addF `Par` subF `Par` divF `Par` negF)
  ) `Par` addF
  `Merge`
  addF `Par` castI
  ))</pre></blockquote>
<p>I won't talk about the toDot code right now, as it's not too impressive
compared to the rest of the code - but if you want to look the whole lot is
in my messy Subversion repository:</p>
<blockquote><pre>svn co https://code.goto10.org/svn/maximus/2009/heist heist</pre></blockquote>
<p>And why the name Heist?  Maybe I'm trying to steal FAuSt's thunder!  Or it could just
be that it's got an H and an S in it...</p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2009-12-04_heist_dataflow_algebra.html</link><guid>http://claudiusmaximus.goto10.org/cm/2009-12-04_heist_dataflow_algebra.html</guid><pubDate>04 Dec 2009 01:23:45 GMT</pubDate><category>haskell</category></item><item><title>Video encoding tips</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p>A long while ago I documented how I went about
<a href="2008-02-04_encoding_ppm_wav_to_ogg_theora_vorbis.html" title="PPM+WAV to Ogg Theora+Vorbis">encoding videos</a>.
I have since found a much better way to do this, adapt as you see fit for
fps and bitrates, and it's possible to do it without intermediate image
files - handy when you're experimenting with high definition video.</p>
<blockquote><pre>ppmtoy4m -S 444 -F 50:1 &lt; "video.ppm" |
ffmpeg2theora -f y4m -V 1000 -o "video.ogg" -</pre></blockquote>
<blockquote><pre>oggenc -b 192 -o "audio.ogg" "audio.wav"</pre></blockquote>
<blockquote><pre>oggz-merge -o "final.ogg" "video.ogg" "audio.ogg"</pre></blockquote>
<p>If you do have image files already, ffmpeg can convert them to a yuv4mpeg stream.</p>
<blockquote><pre>ffmpeg -f image2 -i "img%05d.tif" -pix_fmt yuv444p -f yuv4mpegpipe - |
y4mscaler -I sar=1/1 -O preset=dvd |
mpeg2enc -f 8 -q 2 -o "video.m2v"</pre></blockquote>
<p>y4mscaler-9.0 doesn't compile out of the box with the latest mjpegtools
libraries, here's the fix (at least for libmjpegtools-dev version 1:1.9.0-0.5ubuntu1):</p>
<blockquote><pre>--- y4mscaler.C.orig    2009-10-28 00:32:21.000000000 +0000
+++ y4mscaler.C 2009-10-28 00:33:51.000000000 +0000
@@ -194,7 +194,7 @@
   if (source.read_stream_header(fd_in) != Y4M_OK)
     mjpeg_error_exit1("Failed to read YUV4MPEG2 header!");
   mjpeg_info("Input Stream Header:");
-  source.stream().log_info(LOG_INFO, "&lt;&lt;&lt; ");
+  source.stream().log_info(mjpeg_loglev_t("info"), "&lt;&lt;&lt; ");
 
   /* set target stream defaults from source stream */
   target.init_stream(source);
@@ -216,7 +216,7 @@
   /* set up target stream */
   target.stream().write_stream_header(fd_out);
   mjpeg_info("Output Stream Header:");
-  target.stream().log_info(LOG_INFO, "&gt;&gt;&gt; ");
+  target.stream().log_info(mjpeg_loglev_t("info"), "&gt;&gt;&gt; ");
 
   /* do some scaling */
   scaling.create_scalers(source, target);</pre></blockquote>
<p>And just another little tip: Dirac encoding is still awesomely slow, so I'm
sticking with Theora (or MPEG2 for DVD) for now.</p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2009-11-21_video_encoding_tips.html</link><guid>http://claudiusmaximus.goto10.org/cm/2009-11-21_video_encoding_tips.html</guid><pubDate>21 Nov 2009 14:32:10 GMT</pubDate><category>linux</category><category>video</category></item><item><title>Live At Kiblix</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="http://www.archive.org/details/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13" title="Live At Kiblix"><img src="2009-11-21_live_at_kiblix.png" alt="Live At Kiblix"/></a></p>
<p>Live improv techno performance on 2009-11-13 at Kiblix, Maribor, Slovenia, using Pd, Gem, GridFlow, etc.</p>
<p>Downloads of the digital render:</p>
<ul class="downloads">
<li><a href="http://www.archive.org/download/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13.mpeg">DVD</a> (1.5GB)</li>
<li><a href="http://www.archive.org/download/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13.ogv">Ogg</a> (154MB)</li>
<li><a href="http://www.archive.org/download/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13/ClaudiusMaximus_-_Live_At_Kiblix_2009-11-13_512kb.mp4">MPEG4</a> (139MB)</li>
</ul>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2009-11-21_live_at_kiblix.html</link><guid>http://claudiusmaximus.goto10.org/cm/2009-11-21_live_at_kiblix.html</guid><pubDate>21 Nov 2009 14:44:44 GMT</pubDate><category>hyperspace</category><category>pd</category><category>video</category></item><item><title>buildtorrent update</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><strong>buildtorrent</strong> used to have its own page, but
that part of this website has been dismantled, so here is the
content that was previously available:</p>
<blockquote>
<h4>Synopsis</h4>
<p><strong>buildtorrent</strong> [<em>OPTIONS</em>] <em>-a announceurl input
output</em></p>
<h4>Description</h4>
<p><strong>buildtorrent</strong> is a torrent file creation program. Given an
announce url and an input file or directory, <strong>buildtorrent</strong>
generates an output <em>.torrent</em> file that can be used by
torrent clients.</p>
<h4>Options</h4>
<dl>
<dt><strong>-a</strong> <em>announce</em>, <strong>--announce=</strong><em>url</em></dt>
<dd>Announce URL (required).</dd>
<dt><strong>-A</strong> <em>announces</em>, <strong>--announcelist=</strong><em>announces</em></dt>
<dd>Additional announce URL list.</dd>
<dt><strong>-l</strong> <em>length</em>, <strong>--piecelength=</strong><em>length</em></dt>
<dd>Piece length in bytes (default 262144).</dd>
<dt><strong>-c</strong> <em>comment</em>, <strong>--comment=</strong><em>comment</em></dt>
<dd>User comment (omitted by default).</dd>
<dt><strong>-p</strong> <em>private</em>, <strong>--private=</strong><em>private</em></dt>
<dd>Private flag (either 0 or 1).</dd>
<dt><strong>-D</strong>, <strong>--nodate</strong></dt>
<dd>Omit the <em>creation date</em> field.</dd>
<dt><strong>-C</strong>, <strong>--nocreator</strong></dt>
<dd>Omit the <em>created by</em> field.</dd>
<dt><strong>-m</strong>, <strong>--md5sum</strong></dt>
<dd>Add an <em>md5sum</em> field for each file.</dd>
<dt><strong>-s</strong>, <strong>--show</strong></dt>
<dd>Show generated torrent structure.</dd>
<dt><strong>-S</strong>, <strong>--showall</strong></dt>
<dd>Show generated torrent structure, including piece data.</dd>
<dt><strong>-q</strong>, <strong>--quiet</strong></dt>
<dd>Quiet operation with reduced output.</dd>
<dt><strong>-V</strong>, <strong>--version</strong></dt>
<dd>Show the version string.</dd>
<dt><strong>-h</strong>, <strong>--help</strong></dt>
<dd>Show a help screen with brief usage information.</dd>
</dl>
<h4>See also</h4>
<ul>
<li><a href="http://wiki.theory.org/BitTorrentSpecification">http://wiki.theory.org/BitTorrentSpecification</a></li>
</ul>
</blockquote>
<p>The above is the manual page from the
<a href="http://claudiusmaximus.goto10.org/files/coding/buildtorrent/buildtorrent-0.7.2.tar.gz" title="buildtorrent-0.7.2.tar.gz">buildtorrent-0.7.2 source tarball</a>,
double-check your local buildtorrent package for the manual corresponding
to the version you have.</p>
<p>Some new news now: progress on the 0.8 release of buildtorrent is
very slow, as I have too many other things I prefer to spend my time on.
The roadmap is roughly:</p>
<dl>
<dt>0.8</dt><dd>implement the already-documented file list feature</dd>
<dt>0.9</dt><dd>fix all remaining bugs</dd>
<dt>1.0</dt><dd>final release</dd>
<dt>2.0</dt><dd>go crazy with all kinds of freaky features</dd>
</dl>
<p>Hopefully 1.0 will get finished by the end of the decade.  Jan Stępień
sent me (a couple of months ago...) a patch for multi-threaded hashing, but
I didn't have a multi-core machine at the time - expect that as an optional
configure-time switch in Subversion as soon as I've had time to test it.</p>
<p>The freaky features I have in mind for 2.0 include distributed .torrent
creation within a trusted swarm for later publication to an untrusted swarm.
It should allow torrents to be created when not all the files are local without
transferring large amounts of data.</p>
<p>You can get the development version of buildtorrent here:</p>
<blockquote><pre>svn co https://code.goto10.org/svn/maximus/buildtorrent buildtorrent</pre></blockquote>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2009-11-21_buildtorrent_update.html</link><guid>http://claudiusmaximus.goto10.org/cm/2009-11-21_buildtorrent_update.html</guid><pubDate>21 Nov 2009 13:46:18 GMT</pubDate><category>torrent</category></item><item><title>Kiblix Maribor</title><description><![CDATA[<div xmlns="http://www.w3.org/1999/xhtml">
<p><a href="http://rdex.goto10.org" title="rdex">rdex</a> has a new website,
all shiny and new in preparation for the
<a href="http://www.kibla.org/en/news/news/?no_cache=1&amp;tx_ttnews[tt_news]=1343" title="Kiblix">Kiblix festival</a>
in Maribor, Slovenia this week.  The rdex gallery installation will feature a physical
space map of the parameter space hitherto only represented virtually, and runs
from this Thursday 12th through to Saturday 14th November 2009, with the online
portion remaining afterwards as an artifact of the process.
</p><p>I'll also be performing improvised techno with hyperspace visuals on the
Friday, see the <a href="http://www.kibla.org/en/" title="Kibla">Kibla</a>
website for full schedules and more info - it's a packed week with workshops too.
</p>
</div>]]></description><link>http://claudiusmaximus.goto10.org/cm/2009-11-10_kiblix_maribor.html</link><guid>http://claudiusmaximus.goto10.org/cm/2009-11-10_kiblix_maribor.html</guid><pubDate>10 Nov 2009 16:00:00 GMT</pubDate><category>event</category><category>hyperspace</category><category>music</category><category>video</category><category>web</category></item></channel></rss>
