making an hourly chime with cron

Update: this is old and, like most good things in X, likely has been broken by Wayland.

I wanted to have a “Hey, be here now!” ping throughout the working day. Something loud enough to hear, but not irritating.

Doing this with cron was harder than you might expect. It seems that sound is typically part of the X11 display infrastructure, so you need to give the command permission to make a noise on this particular machine’s display. Here’s the crontab line I came up with:

# m h    dom mon dow   command
  0 9-17 *   *   1-5   export DISPLAY=:0 && /usr/bin/play -q /home/scruss/sounds/ting/ting.wav

That translates as: at 0 minutes past the hours of 09:00 to 17:00 on any weekday (day of week = 1-5, and we don’t care about day of month or which month it is), execute the command play (part of the sox package) with no text output (-q). cron needs environment variables like DISPLAY set, and prefers full command paths. It may trigger a second or so after the turn of the hour; this is good enough for me.

As for the alert, I wanted something distinctive — percussive, short, bright — but with a tiny bit of modulation to stop it sounding like a bland computer-generated sine wave. This is what I made; click on the image and the sound should play or download:

ting-audacityIt’s essentially a 2093 Hz (C₇) sine wave, mixed with itself frequency-modulated at 7 Hz. Why 7 Hz? Apart from sounding about right, 2093 is exactly divisible by 7, 13 & 23, so I used a factor for neatness.

There was some later messing about in Audacity (mostly fades and length edits; I forget exactly what). The two components were generated using sox:

sox -n ting-plain.wav synth 1 sine C7 fade l 0 1 1
 sox -n ting-vibrato.wav synth 1 sin C7 synth 1 sine fmod 7 fade l 0 1 1

Yes, sox does have pretty horrible syntax, doesn’t it?

The frequency-modulated one seems to be pretty close to the final result. It would be less time spent trying to save time …

Estimating the speed of sound with stereo microphones and Audacity

Screenshot from 2014-01-13 22:43:03With a pair of binaural mics placed 33.7 cm apart feeding into a stereo USB sound card (a Griffin iMic), I clapped near the left mic. It took 39 samples (884 µs) for the peak to travel between the microphones. That gave me a speed of sound of 381 m/s. A bit high, but the conditions this evening weren’t ideal, and I only set up the experiment with cursory care.

The iMic seems unusual in having a stereo line/mic input. Most other (cheaper) USB dongles only have a mono input.

My Name is not Alvin

When I first heard of Alvin Lucier‘s “I Am Sitting in a Room” I thought it would be interesting to attempt a recreation with the tools I had on hand. Rather than shuffling tapes around, I recorded on my iPod Touch, and then e-mailed the file to my laptop to play back. I repeated this sixteen times. This is what I ended up with: my name is not alvin [mp3].

"My Name is not Alvin" recording rig

I’m pretty sure all I ended up recording was the hard drive and the backlight on my MacBook. By the final iteration, the cricket-like chirping is centred pretty close to 5400 and 16000 Hz.

i was the sound man (kinda)

I went to hear Chris Coole yesterday at The Local, and got pressed into the not-very-arduous duty of looking after the levels. With only voice and instrument, it’s not that hard, and I only once managed to produce an ear-splitting blast of feedback. There was a slight ring if Chris leaned forward and his guitar started to feed back a couple of times.

I also ran my first soundboard-audience matrix recording rig, with the PMD620 recording off the board, and my old minidisc recording from my table. The Local’s not short of ambient noise, so it’s nice to control it. The board gives a clean but rather dead mono recording, while the audience mics pick up lots of colour (and dropped plates, door chimes, …)

I haven’t put the full matrix together yet, but tried it on one excerpted song. Once you know what you’re doing, aligning tracks in Audacity is pretty simple – just find a clear note or beat in each track, get the tracks roughly aligned with the Time Shift tool, then zoom in as close as you can to refine the match. I suppose I should have delayed the audience track by about 0.01s to mimic the distance from the stage, but that’s a bit nerdy. Limiting the audience to 25% of the final mix, I get a great warm sound, but one that’s unfortunately almost entirely monaural.

auplabels – extract times of tracks in an Audacity file for adding labels

auplabels – extract times of tracks in an Audacity file for adding labels (download).

Audacity 1.3’s method of track splitting has always seemed a pain, so I wrote the above to help me.

Running auplabels file.aup will generate a somewhat sparse file of track offsets:


You’ll want to edit this to add track names (there should be a tab between the first column and the title):

0.00000000      Battle of the Blues
191.57333333    I Quit My Job
376.08000000    Ain't Goin' My Way
550.76000000    Wake Up Hill

If you use File -> Import… -> Labels… to import this into your project, the label track should exactly align with your track splits.

(Of course, this should really be an XML application since Audacity AUP files are XML, but issues were had.)

the analogue hole

I have a bunch of Catherine’s old family recordings to digitise (do people still do that – sit around a tape recorder and make recordings?) and I had recorded one of Ken’s shows on minidisc, so I needed a relatively clean way to get analogue audio onto the computer.

I ended up getting a Griffin iMic, a small USB audio input device. The sound quality is remarkably clean; here’s a sine wave recorded from CD to minidisc, then recorded on the iMic:



The  iMic seems to work with all Mac audio software as an input device. The free Final Vinyl recording sofware is pretty, but a bit buggy and annoyingly, only works when the iMic is connected. I just use Audacity, and have done with it.

Audacity 1.3.2 broken as designed

When I’ve spent the last 3 hours splitting tracks in Audacity, the last thing I want to see is:

audacity annoyance message

They’ve changed the way that Split works, so you now get a bunch of semi-useless ‘clips’ that you can’t do anything with. You can’t select a clip, or move them to new tracks (at least under Linux and OS X).

How apt that one of the tracks was trying to split was I Wanna Destroy You.