Photo (c) Jan Trutzschler von Falkenstein; CC-BY-NCPhoto (c) Rain RabbitPhoto (c) Samuel CravenPhoto (c) Gregorio Karman; CC-BY-NC

Music

Research


Other

Older things: Evolutionary sound · MCLD software · Sponsored haircut · StepMania · Oddmusic · Knots · Tetrastar fractal generator · Cipher cracking · CV · Emancipation fanzine

Blog

I've got lots of recipe books of course, some good ones - but for Christmas I got given the latest Hugh Fearnley-Whittingstall book River Cottage Every Day and it's spot on.

I've got HFW's Fish book and that is like a massive encyclopedia; it's good, but I haven't cooked many of the recipes cos they're not really compatible with the kinds of thing you can get from an ordinary supermarket. But this new book is much more appropriate for an ordinary person cooking at home - loads of variety and the ingredients aren't crazy.

A lot of recipe books have "easy" "everyday" stuff that's really obvious (as long as you know how to cook the basics), and some of the more interesting books have stuff in that's far too intricate or rare to ever get round to trying.

It's a rare trick to have a full set of interesting, do-able recipes that taste really nice and don't involve too much messing about.

Here's a couple of things I've made from the book:

Well it's up to you what you make of that list - it's only the ones I decided to make, and frankly they were all bloody lovely.

food · Permalink / Comment

I've been getting loads of copies of the roulette spam - you know? The one that appears to be a misdirected email going:

please tell me when you will send me your roulette trick? You promised you'll send it few weeks ago :(

yo mate, ok I'll give you my trick but if you give it someone else I'll kill you :) you know in roulette you can bet on blacks or reds. If you bet $1 on black and it goes black you win $1 but if it goes red you loose your $1. but I found a way you can win everytime: ...

It's one of those mathematical illusions: really hard to find any fault in it, so... is it a quick route to easy money?

Kochanski wrote a good explanation of how the language tricks you as well as the maths, so read that. Executive summary of the maths: "Basically, this algorithm is a way of generating lots of small wins and a few huge losses."

Someone else even wrote some software to prove it - they ran the software lots of times and found exactly that effect, that they ended up with loads of small wins and a few huge losses, meaning that on average you're out of pocket.

Apparently there's even a name for this kind of faulty-logic: a martingale.

economics · Permalink / Comment

I've been making debian packages of SuperCollider recently. Here's a quick note of how to do it - it should work on any debian-based system though my experience is on ubuntu and puredyne:

First make sure you have the standard packages needed for getting and building things:

    sudo apt-get install build-essential debuild subversion gnupg \
      libfftw3-dev libsndfile1-dev scons libjack-dev libreadline6-dev \
      libicu-dev libavahi-client-dev libasound2-dev libcwiid1-dev \
      libxt-dev python-support sharutils chrpath

Then we'll create a folder "scdeb" in which to do our work, and in it we'll get a fresh checkout of the latest SuperCollider source:

    mkdir ~/scdeb
    cd ~/scdeb
    svn co https://supercollider.svn.sourceforge.net/svnroot/supercollider/trunk scsvn

Now, inside the source tree is a script which will build a neat source package for us (it strips out the SVN folders as well as various non-linux stuff):

    cd scsvn/common/Packager
    ./package -s

When this is done there's a .tar.gz file called something like SuperCollider-2010-02-22-Source-linux.tar.gz (the date will be today's date).

We'll need to move that around as well as unpack it into the special positions that debian's bundling expects (it's quite strict about the filenaming conventions):

    cd ~/scdeb
    cp scsvn/common/Packager/SuperCollider-2010-02-22-Source-linux.tar.gz supercollider_3.3.1~svn9872.orig.tar.gz
    tar zxvf supercollider_3.3.1~svn9872.orig.tar.gz
    mv SuperCollider-Source supercollider-3.3.1~svn9872

A couple of things to note about the filenames:

OK, next we go into the nice clean source folder we've made, add the debian stuff, and edit the changelog to say what's new in this release.

     cd supercollider-3.3.1~svn9872
     svn export https://supercollider.svn.sourceforge.net/svnroot/supercollider/packages/ubuntu debian
     vim debian/changelog

The format of the changelog is again quite strict - I won't describe it here but search the web for debian changelog format to learn more. Don't include all the changes that have happened, only the ones relevant to this debian packaging (e.g. "fixed patch for debian paths", or also "new upstream release").

Now you're ready to do the build.

      debuild

When that process finishes it'll ask you to sign the package using a GPG signature associated with your email address. (You can deactivate this signing using a flag to debuild, but if you don't sign it then no-one can trust where it came from so it won't be allowed into package repositories.)

Alternatively for a debian source package you can run

      debuild -S

Whichever of those two you run, you'll end up with packages built in the parent folder (~/scdeb) which you can install locally using dkpg -i or upload to ubuntu/debian using dput.

linux · 1 comment

MythTV does good stuff but it doesn't (yet) do BBC iPlayer integration. I found this great blog post about adding BBC live streaming to MythTV and it's almost what I wanted, but I don't want the live streams cos I already get them through the receiver!

What I do is download automatically using get_iplayer so that BBC programmes become a lot like podcasts/vodcasts. So what I want is a MythTV menu showing the media files I've downloaded that way. Here's how I did it, based heavily on that blog post I linked above:

(Note: MythTV v0.22 only since 0.22 introduces a new GUI system and 0.23 is going to introduce a nice iplayer-compatible thing I think...)

First of all, I already have a bash script called automatically to do the downloading. Whenever the downloading is done, I want to regenerate an XML menu of available files, for Myth to show me. Here's the code I added to my bash script:

# Now write the XML menu. this folder I created myself, choose yr own path:
datadir=/var/lib/iplayer
cd $datadir
menupath=$datadir/watch_iplayer.xml

xmltop="<?xml version=\"1.0\" encoding=\"UTF-8\" ?>
<mythmenu name=\"WATCH_IPLAYER\">
"
xmlbot="
</mythmenu>
"

echo $xmltop > $menupath
# NOTE: this ls command only catches files with extension .m__
for f in `ls -1t *.m?? | head -n 15`; do
        trimname=`echo "$f" | sed -e s/_default//g -e s/_//g -e s/\.m..$//g`
        echo "
    <button>
        <type>TV_WATCH_IPLAYERTHING</type>
        <text>$trimname</text>
        <description></description>
        <action>EXEC xterm -e mplayer -fs /var/lib/iplayer/$f</action>
    </button>" >> $menupath
done
echo $xmlbot >> $menupath

So just to unpack that script a little bit: we're building up some XML code bit-by-bit. First I specify the folder, then define some strings which will be the top and bottom of the XML menu. Then the choice of which files to list comes from this line:

ls -1t *.m?? | head -n 15

That asks the ls command to list files in reverse order of their date, and only to include files whose file extension starts with "m" (.mp3, .mov, .mp4 - it's just luck they all have the "m" in common). Then the head command trims that down to the most recent 15 - you might not want that limit but the interface becomes a bit unwieldy otherwise.

For each file we create a menu entry which executes:

xterm -e mplayer -fs /var/lib/iplayer/$f

This is just invoking mplayer, but wrapping it in an xterm call because otherwise I don't seem to have any option to exit the programme!

So when this script runs, it iterates those 15 most recent files and outputs an entry in the XML file for each of them. It generates this watch_iplayer.xml file.

The final thing that needs doing is telling MythTV to include this menu in its interface. I did this in almost exactly the same way as described near the end of the blog I linked above: copy one of myth's menu layouts to a special folder in your home:

cp /usr/share/mythtv/themes/defaultmenu/library.xml ~/.mythtv/library.xml

and then edit it to add a link to your new menu:

<button>
    <type>MENU_WATCH_IPLAYER</type>
    <text>Watch iPlayer downloads</text>
    <description>watch live TV streamed from BBC</description>
    <action>MENU watch_iplayer.xml</action>
</button>

(I used a softlink to jump out of this folder to where my watch_iplayer.xml file really is.) Hey presto, we can watch timeshifted iPlayer just like we can watch other timeshifted TV.

linux · Permalink / Comment

Gnuplot's documentation is downright baffling so it took me ages to work out if it was even possible to do a radar chart (aka spider chart, star plot, polar chart). Here's how I managed it in the end.

  set angles degrees
  set polar
  set grid polar 120.
  unset border
  unset param

  set style data filledcurves 
  set style fill solid 0.5

  set datafile separator ","

  set xtics axis nomirror
  set ytics axis nomirror
  set yrange [-45:45]
  set xrange [-45:45]
  set size square
  set title "Radar chart"

  plot '~/docs/mydata.csv' using 1:2 notitle, '' using 1:3 notitle, '' using 1:14 notitle, '' using 1:25 notitle

My datafile was a CSV file where the first column gave the angle in degrees (as you can see in the plot, I've only used three angles: 0, 120, 240). You can see in the last line of that code that I've separately chosen to plot polygons for columns 2, 3, 14, 25 from my data.

linux · 2 comments

I've just discovered the really handy mpd (music player daemon) which is pretty much the perfect command-line geek's music player service. No graphical interface, no nothing.

Anyway

It's currently playing my MP3s on shuffle and it's great, but the MP3s are a bit too varied in their volume: some are too loud, some are too quiet. And this is where the magic of ReplayGain comes in. ReplayGain is a hint that can get embedded in an MP3 about how loud it should be, and there's a linux command called "mp3gain" that can analyse your files for you and make sure they're all equalised volumewise. If you have a folder containing ten MP3s from an album, you can run a command like

   mp3gain ~/Music/theAforementionedAlbum/*.mp3

and it'll do the business. The extra-clever bit is that it also applies album-wise ReplayGain - assuming that all the files you've given it are off the same album, which has been carefully mixed to have loud bits and quiet bits, it'll specify an albumwise level as well as an individual trackwise level.

So far so good, but what if you have a million albums of a billion MP3s? You'd need to run that command once for each album.

Or you could do some command-line kung-fu. This command is what's running on my linux box right now (should work on mac too):

   find -L ~/Music/ -name "*.mp3" -exec dirname "{}" \; | uniq | while read line; do mp3gain -k -o -r "$line"/*.mp3; done

It uses find to find all my MP3s, dirname to find which folder they're in, uniq to make that a unique list of folders, then while read line to feed that info one line at a time to the mp3gain command. Therefore it's feeding it with one folderfull at a time, rather than just one MP3-file at a time, which should allow it to do the ReplayGain thing best.

linux · Permalink / Comment

Plum ketchup is a great autumn recipe. I'm publishing it now (spring) cos I made up a big batch of plum ketchup to make christmas presents this year - and I think it went down pretty well... I think it's well nice, at least! Goes especially well on sausages or fish.

Put tomatoes, plums and onions in a large saucepan with the spices. Bring to the boil and simmer gently for 45 minutes or until the onion is soft. (Don't be tempted to add water, the fruit+veg will start to produce enough liquid after a few minutes.)

Cool the mixture for 10 minutes, then blend or process it until smooth. (Some would remove the spices before blending but I don't.) Then strain through a sieve back into the pan.

Add remaining ingredients, stir over a gentle heat (do not boil) until the sugar dissolves. Simmer uncovered until the mixture thickens to the right consistency (about 15 minutes, stirring occasionally).

Pour the hot ketchup into hot sterilised bottles or jars, and seal while hot.

(This is based on a standard tomato ketchup recipe, but with half the tomatoes replaced by plums, and some cinnamon added to complement the plum flavour.)

recipes · Permalink / Comment
feminism · 1 comment

Other recent posts: