12 Days of Crimbo

I had a plan in the fortnight before Christmas to write 12 songs in 12 days. I nearly made it in time!

I’ve posted all of the pieces as a free album on Bandcamp. My only request is that if you download it and can afford to, please donate to one of the listed charities, such as Crisis.

While I didn’t get twelve pieces in 12 days, each piece only got a few hours of attention. Because Christmas music tends to be tonal, I looked into more instrumental synthdefs and because of the constraints on time, I tended to borrow and adapt instead of inventing totally new sounds. I’ve not got a pretty good additive bell, based on Risset, a good karplus strong plucked sound and decent jingle bells. These shall go up shortly on the sccode site.

I used glitched jpegs as still images for each track on Bandcamp, so when I decided to also upload the tracks to youtube, I created a glitch movie maker script. It’s based on a workshop I saw Antonio Roberts do at Tate Britain. He opened up a jpeg file, typed some junk into it and then it glitched. I wrote a script to insert junk into jpegs. It first looks at the aiff, to decide how many jpegs will be needed, makes all of them, then turns them into a music video. I’ve posted it to github.

This is an example of the script’s output. All 12 pieces are up on YouTube also, if you would like to have a look.

Glitching Sound: how to data bend with imagemagick

Inspired by Antonio Roberts’s excellent tutorial on how to databend with Audacity, and following on from my previous tutorial on how to data bend audio, this post explores how to glitch audio using image software. Many of the required tools use the command line. This will work with linux, unix and mac. If you want to use windows, you will need to edit the autobmp.sh bash script so that it does not use the /tmp directory.

You will need

  • The autobmp.sh script
  • Imagemagick (You probably already have this if you use linux.)
  • BASH (you already have this if you use linux or if you have a terminal on your mac)
  • A utility to convert between audio formats that supports the .au format. I use sox, which is cross-platform and available via apt-get.
  • Audacity

Why these formats?

.au and .bmp are both uncompressed formats, so every sample of audio becomes the R, G or B value of a pixel. AIFF and WAV files are also uncompressed, but the files have more structure to them that is not sound data, so .au seems easier.

Getting Started

10 seconds of a sawtooth wave

Using sox to convert between uncompressed audio formats is really easy. To convert a file called foo.wav to an au file, you would just type: sox foo.wav foo.au  It looks at the extension and does the right thing.
Put the script in a directory in your path, OR just put it in your current working directory.
Once you’ve got foo.au, to convert it to a bmp, you’d type: ./autobmp.sh foo.au foo.bmp  This will give you a file called foo.bmp, which is the bmp image of your audio.
Let’s say, you’ve done a bunch of transformations and now have a file called bar.bmp. To turn that back into audio, you would type: convert -depth 16 bar.bmp rgb:bar.pcm  It is now back in an audio format, but the header has gotten slightly tweaked, so we’re not done. Open Audacity, and under the File mean, select, ‘import’ and then ‘raw audio’. Pick bar.pcm in the file chooser. On the popup window, tell it that the file is ’16-bit linear’ and ‘little endian’. There will be a few samples of crap at the beginning of the imported audio. That’s what’s left of your old .au header. you can delete it if you want. there will also be a bit of silence at the end of the file. This was padding added to make the image rectangular. To convert this into AIFF or WAV or MP3 or whatever, select ‘Export’ from the file menu.
If you have ended up with a different image format, such as jpeg or whatever, you don’t need to first convert back to bmp. To get from baz.jpeg back to audio, use convert directly and carry on as above. convert -depth 16 baz.jpeg rgb:baz.pcm

What to do while it’s a graphics file?

This is the creative bit! Converting to a lossy graphics format, such as jpeg adds some noise, so that might be fun. If you do that, you can glitch the jpeg by opening it in a text editor and doing a bit of typing at various points in the file. This causes weird visual distortions, which will become audio distortions when you convert back.
You can also try opening the graphics file in a graphics program. Some of the graphics effects may make interesting sound changes, although many won’t. Experimentation is needed. You can also try drawing on the image. Wide lines of a solid colour will create weird DC offsets, so if you want to avoid that, consider either using very thin lines or else setting an opacity of under 100%.
Have fun!

Music commissions make great gifts. Order now for this holiday season!

Working bmp converter

This is fun you can try at home, if you are on a unix or linux system or on OS X. You must have imagemagick installed, as well as the bash shell. For best results, install sox also.

This script has just been shown to work and prints out too many debugging statements and deals with a weird bug in bash on my system. Cut and paste the code at the bottom and save to a file called autobmp.sh

  1. Open your favourite audio tool, such as audacity and generate a sawtooth wave.
  2. Save it in the same directory as the script as a wav file: saw.wav
  3. Open a terminal, and cd to the directory you saved your wav file in
  4. Type sox saw.wav saw.au
  5. Type autobmp.sh saw.au
  6. Open saw.au.bmp in an image viewer. Isn’t it amazing?
  7. Type convert saw.au.bmp saw.jpg
  8. Open saw.jpg in a text editor, like emacs
  9. Scroll down to random points in the file and type a few characters. Do this a few times.
  10. Save the file as glitch.jpg
  11. Open glitch.jpb in an image viewer. Isn’t it amazing?
  12. Type convert glitch.jpg -depth 16 rgb:glitch.au
  13. Open audacity (or your favourite robust audio editor) and tell it to import raw data (under the File menu in audacity)
  14. Treat the data as 16 bit little endian
  15. Play it back. Isn’t it amazing?

You get a little glitch at the start of the file, whenever you import an au file as raw data. That’s the au header. You can delete the glitch and re-save. There is probably an automated fix for this, but there aren’t enough hours in the day. You’ll also get a little bit of silence appended to the end of the file. This is so the number of samples makes a square image size for the bmp.
Try out other ways of messing with the image, such as drawing on it, especially with less than full opacity or otherwise transforming it. Have fun times! The script is below the sales pitch.
I figured out how to do this and posted it here because I was commissioned to write a noise piece. When you commission music, you not only cause a new piece of music to exist, but you might cause some new tools to become available to other composers. Music commissions make great gifts for birthdays or other holidays. Order now to make sure your commission arrives in time for Christmas or Hanukkah.


#!/bin/bash

file=$1

size=`wc -c $1 | cut -f 1 -d ' '`
ints=`expr $size / 6`
root=`echo "sqrt($ints)" | bc`

x=$root
y=$root
echo "$x x $y"
squared=`echo "$x * $y" | bc`
    echo "squared is $squared"

while [ $squared -lt $ints ];do
    x=`expr $x + 1`
    squared=`echo "$x * $y" | bc`
    echo "squared is $squared"
done

echo "expr $squared - $ints"
diff=`expr $squared - $ints`
diff=`echo "$diff * 6" |bc`

echo "diff is $diff"

base=`basename $file`
temp=`echo "/tmp/$base"`
cp $file $temp

truncate -s +$diff $temp


size=$x
size+="x"
size+=$y

echo $size
command=`echo "convert -size $size -depth 16 rgb:$temp $file.bmp"`
echo $command
`$command`

Glitching sounds

Today, I went to the Loud Tate event. My friend Antonio Roberts was presenting some work. Also, there were workshops on glitch and modular synthesis.
Antonio’s piece was a projection of ever changing glitch, which my mobile phone camera failed to adequately capture. It was being shown on the underside of an arch in a round stairwell. Tate Britain is really full of art, so it must be hard to accomodate one day installations.

The synthesisers were set up in the middle of a gallery. Three guys with cool modular systems were buried in their wires, twisting knobs and making beats. I’m not totally sure how educational it was, but I did get to look over their shoulders. Modules have changed a lot since I got my MOTM system in 1998-2000. There are a lot of cool new ideas and, I suspect, new ways of labelling the old ideas, which make it slightly confusing for a fogey like myself. I commented to somebody that synthesisers had changed a lot in the last 14 years and, anyway, it turns out this event was actually meant for people under 25.
I suspect that at least one of the guys with the synths was playing with the analog modular group that I had tried to take my dad to see, the night that he developed his heart problems. I kind of wanted to ask if they were the same guys, but I thought the conversation might get awkward…
I do have one new module that I’ve yet to fully explore, and I’m pondering adding a few others to get caught up with these modern times. I’m looking forward to using my new module in a commission. It models orbital dynamics of planets in some way. I’m hoping it can be made to undulate, which is a customer request I’ve just gotten.
The visual glitchers were also having a meeting, so I went there to see Antonio. Unfortunately, I missed their presentations, but I did catch Antonio giving a quick tutorial in graphic glitching. He saved an image as a bitmap and then opened it in Audacity as a u-law file. He added some phasing and echo effects and then re-saved it as a bmp. It did interesting things to the image. What I want to experiment with is going the other way. This would likely entail:

  1. Convert an audio file to ulaw format.
  2. Save that file as a .bmp
  3. Open the .bmp in an image editor, such as GIMP
  4. Apply effects to the image, such as reversing it, colour correction, try drawing – I need to play around on this step to see what would happen
  5. Open the bmp in audacity. If it sounds good, convert it back to a WAV or AIFF.

I’m going to try this out when I get a moment. Right now all my commissions are all analogue, so this would be a good experiment for a digital commission, when one of those arrives. I will report back on how it worked in practice.
Tomorrow is an ‘informal meet and greet’ in London for analogue synth users. I’m going to bring my new module – and a screw driver. The mounting rails on it are super fiddly and I cannot get the thing to screw in without cross-threading it. It’s become too frustrating, so I put it aside and hopefully somebody with a steadier hand and more patience can help out.
Your commissions are fun to research and fun to make. They make great gifts. Order now and delivery is guaranteed in time for Christmas or Hanukkah. Act now to get the sale price of just £5 for one piece – there are only two left at that price point!

Do you love noise music? Do you have fashion? Drop me an email if you’d like your image to be in forthcoming posts about noise and fashion