Robin's Latest Site

Robin's expertise is in audio/video post-production and related hardware/software research and development.

Currently Robin mainly works as contractor for Harrison, Manufacturer of the World's Finest Consoles, acts as core-developer for Ardour and develops a line of professional Audio Plugins.


Beautiful Emaily

INBOX Jan 2011 - drowning in email

You got to talk to someone some day
'coz when the words are gone is too late.

I need a statement from thee,
Right now.
An explanation for thee,
Right now.
Clarification of thee,
Right now.
Some good communication,

Why? why? why?
Do ordinary people specialize?

[from Keziah Jones': beautiful emily]

· 02.03.2011 17:29 · Robin Gareus

JACKdbus - Desktop integration - backend-switching

Prototype of automatic backend-switching for JACK2 using dbus.

You may know this Mac/OSX feature: one plugs or unplugs an external audio-interfaces and the system automatically switches the sound to the new device. - It may not always be what you want, but it is an very handy feature especially for mobile systems. and here's how to set this up for JACK on GNU/Linux..


First, we need a mechanism to switch the “JACK backend” in order to switch between audio-interfaces. The task includes taking care of re-connecting physical I/O ports in case they're different on each device.

Second, said mechanism needs to be triggered automatically when a new device is connected or if a device goes away. Here's a short annotated demo-video:

(If Flash is installed JavaScript is activated, you can watch a video inside this web page.)

(well yes, I should have ripped out that USB cord more visibly.. sorry, next time. I might use a real camera too, then.)



Note: dbus-triggerd and a jack2 debian packages (source and i386) are available from

deb sid main

Installation and testing

  1. get jack2, patch, compile and install (or get the debian package).
  2. compile and install dbus-triggerd (or get the debian package).
  3. download and install to PATH (~/bin or /usr/local/bin), chmod +x.
  4. open a window to watch tail -f ~/.log/jack/jackdbus.log
killall -9 jackd jackdbus # clean start
jack_control eps verbose true        # tell jackdbus to be verbose alsa hw:0 1024  48000 3 # launch jackd on first ALSA interface -p1024 -r48000 -n3 alsa hw:1               # switch to second ALSA interface

Launch some jack clients, players etc and repeat testing with

Automating it with dbus-triggerd

dbus-triggerd is a tool to trigger shell-commands upon receiving a given dbus-signal.

It can be used to invoke in order to change the JACK-backend if

  • a new audio-interface is connected (system-dbus org.freedesktop.Hal.Manager,member=DeviceAdded) → use the newly connected device.
  • an audio-interface is disconnected (system-dbus org.freedesktop.Hal.Manager,member=DeviceRemoved) → switch to a fallback audio-interface.
  • JACK daemon signals device-error (session-dbus org.jackaudio.JackControl,member=DeviceError) → switch to a fallback audio-interface.

The two last are redundant and exclusive. JACKd still needs a patch to send a DeviceError. Using HAL's DeviceRemoved may be problematic for setups with more than two sound-cards if the removed device was not currently the one used by JACK.

Example to launch dbus-triggerd:

make || exit
killall dbus-triggerd

### switch to sound 'hw:0' on any DeviceError
# This requires a patched JACK2, that sends a DeviceError
./dbus-triggerd $@ "type='signal',path=/org/jackaudio/Controller,interface=org.jackaudio.JackControl,member=DeviceError" --shell " alsa hw:0" &

# This an alternative to the above, using the HAL message
#dbus-triggerd $@ --system "type='signal',path=/org/freedesktop/Hal/Manager,interface=org.freedesktop.Hal.Manager,member=DeviceRemoved,arg0=/org/freedesktop/Hal/devices/usb_device_582_74_noserial_if0_sound_card_2" --shell " alsa hw:0" &

### switch to external USB sound device 'hw:2' when it's connected
./dbus-triggerd $@ --system "type='signal',path=/org/freedesktop/Hal/Manager,interface=org.freedesktop.Hal.Manager,member=DeviceAdded,arg0=/org/freedesktop/Hal/devices/usb_device_582_74_noserial_if0_sound_card_2" --shell " alsa hw:2" &


Here be dragons…

The mechanism for backend-switching is implemented by a shell-script (which call dbus-send) that controls jack2d by exchanging dbus-messages. is started with different command-line parameters on-demand by dbus-triggerd.

  • org.freedesktop.Hal.Manager,member=DeviceAdded
  • org.jackaudio.JackControl,member=DeviceError (requires patch to jack2)
  • (or) org.freedesktop.Hal.Manager,member=DeviceRemoved

Note that uses the org.jackaudio.PatchBay dbus-API which is broken in jack2-r4120 (see ticket below) and fixed by Nedko in jack2-r4366.

Future: Instead of patching jack2 to send additional messages (here: org.jackaudio.JackControl,member=DeviceError), the trigger functionality should be built into jackd, but requires a callback to the control API to be added to JACK.

The shell hook-script ( could be implemented easier and more flexible using python (jack-control API bindings) or similar language more suitable to parse and provide audio-port mapping and configuration.


Galtuer 2010

..skiing pneumonia… Picture Gallery

p1100542.jpg p1100580.jpg p1100566.jpg

· 01.01.2011 19:09 · Robin Gareus

Ecology of Ardour


Dave Phillips has written a nice article featuring my recent work on the Ardour3 video-timeline for the Linux Journal.

It is titled An Ecology Of Ardour.

· 20.09.2010 22:22

World Skin - a Photo Safari in the Land of War


I spent last week at V2_ in Rotterdam setting up WorldSkin - an Interactive A/V Installation by renowned artist Maurice Benayoun - for presentation during the International Film Festival Rotterdam 2010.

A visit to World Skin is a poignant experience. Armed with a camera, visitors are placed in a sinister war zone that is visualized on a large projection screen in 3D animation and video. By operating photo cameras visitors may take pictures of the war scenes and experience how the camera becomes a 'weapon' that enables them to wipe out the projected images. Only the outline of the taken picture is left as a silhouette in the projection. Visitors can take a print of the photos they shot with them.

World Skin was first presented 1997 and win the Golden Nica Award at the Ars Electronica Festival in Linz 1998.

The Implementation:

The original version ran on a SGI Onyx System. This years installation is a re-design using openGL, openAL and openCV but featuring the original 1997 Graphics by Raphaël Melki and 4.1 Surround-Sound from Jean-Baptiste Barrièr.

The navigation:

Only the driver using a “wand” (aka Bluetooth Gamepad) can decide about the group trip. In this way, he has the role of a “bus driver”. Everyone can ask about the path alterations.

The photographers:

The participants are active. They have to decide about the group's movements. Otherwise they cannot take pictures of what they are seeing. Several SLR cameras hanging from the ceiling allow them to take photos. Instead of opening its shutter to capture the image, the camera sends coordinates to the computer at the time of release.

The taken shots:

With the camera - a old-fashioned SLR spiked with a 3D tracking system - the visitor can frame the virtual show at leisure. He chooses angles, frames and release time.

The triangulation is implemented with Wii-accelerometers for tilt and rotation (Pitch & Roll) mounted in the Camera, while a web-cam located above the front-screen combined with openCV software is used for detecting the position and horizontal angle (Yaw) of the cameras. Thus, the machine can compute the frame corresponding to the viewer, in relation to the scene and time of the shot.

The World Skin:

For each shot, the corresponding surface (divided into silhouette fragments) is removed from the virtual databases. It looks like a white projection made the set pixels disappear, covered by the camera field. The white fragments constitute a rectangle (the frame), only from the exact point of view of the shot. In other words, the perspective takes over again and we can discover the white surface fragments vanishing into the set depth.

The photography:

After the session, the visitor exits the CAVE and finds a printer and a screen presenting the website, where the last shots are sent in real time. He can leave the place with a printed copy of the shots.

(If Flash is installed JavaScript is activated, you can watch a video inside this web page.)

Qjackctl Dbus

A while ago I've written a patch to qjackctl which adds DBUS support to start and stop the JACK audio server. It's available and enabled by default in qjackctl from version upwards.

The main use-case for it is to bring up the JACK server after a suspend/resume cycle on laptops. More information about this is available on a Wiki Page. This blog will just give minimal usage information to tease you :)

An example script to re-launch JACK with the last chosen preset looks like this:


case $1 in
    (sleep 4 ; dbus-send --system /org/rncbc/qjackctl org.rncbc.qjackctl.start)&
· 10.01.2010 22:39 · Robin Gareus

Roadtriping through the Middle East

Tres bonne année 2010. I'm just back from a three week vacation and my luggage is still somewhere in Bucharest..

Well, let me start from the beginning: My old friend Florian relocated from Amsterdam, NL to Tel Aviv, IL. He owns a pretty cool Mini-Cooper Convertible and the most obvious way to get it down there was - of course - just drive.. After a bit of preparation - ie. to get a Visa for Syria, some change some Euros into Baksheesh suitable currencies and organize a flight back - we hit the road on December 13 2009. Carolina in the back, Florian and me on the front-seats. 10 days, 11 countries, 5500km.

00_map.jpg Amsterdam → Munich → (Villach) → (Ljubljana) → (Zagreb) → Beograd → Sofia → Istanbul → (Akçakoca/Black Sea) → Göreme → حلب/Aleppo → دِمَشقُ‎/Damascus → (عمّان‎/Amman) → البتراء/Petra → (אֵילַת‎/Eilat/Red Sea) → רְחוֹבוֹת/Rehovot

Our deadline was x-mas, so in the beginning we blasted through with almost no stops - known territory - through snow-storms to Beograd where we stayed in a boat-hostel on the Danube river and had 15 cm of snow on the car next morning.. Passing into Bulgaria we left the European-winter behind and welcomed the sun with some Vodka in Sofia. We were on the road every day, apart from Istanbul and Damascus where we stayed two days each. Sounds fast, well it was, but so were we: We had enough time to discover major cities and landmarks on the way. Heck we even did a full day hike around Petra. Looking back, we could have taken 3 Months for the whole journey.

Having been in Istanbul before, the most stunning part of the journey started with the border-crossing into Syria. It took us 90mins to clear customs, which is very fast by Syrian standards, but apparently we got lucky and found the right people to talk to. Aleppo (Haleb) was a culture shock and well worth the stay. It's a messy, dirty and crowded place full of Arab atmosphere. It was by far the largest non-touristic city on our way, buzzing with life that most of the time made no sense to us: “Is that a bank or are they selling passports there?”. While it was sometimes hard to communicate, the people were really friendly and helpful. By the way, parking the car in the Sheraton basement for a night cost just the same as our hotel-room for 3 persons: 1000 Syrian Pound.

Next stop: Damascus. The oldest still inhabited city in the world. Our stay in the Damascus Hostel brought yet another cool adventure. It is located in a tower of the old-city wall and unifies ancient Syrian style, willful design and pleasant hospitality in an adventurous location. Our way in was to climb the old-city wall by rope-ladder. The owner - Raymond - and his team were not only forthcoming and funny but also really helpful, sharing local secrets and advice that got us started exploring Damascus in a way not described in any tour guide. After traveling the north of Syria on our own this suddenly felt like being with a family. The old-city is a huge Labyrinth shared by Christians, Muslims and a few Jews. Damascus is very diverse in all accounts: architecture, people and shops. Lot's to experience, hard to describe..

Unforgettable in Syria is the portrait of Bashar al-Assad, just because it's everywhere you can look at. I also have to say it's the region with the best food - only contested by the Israeli Hummus and Shakshouka..


On we went, passed Amman, and drove to Petra. What we thought would be a few hours of visiting turned into a full day impressive hiking excursion. The site is breathtaking. We took more images there than on all other days combined.. still you best go there for yourself.

Exhausted from the day, we made it just in time to Aqaba before the border-control closes. You expect a international crossing to be signposted, but there's no sign, nothing, we needed to ask a Taxi to drive ahead of us to find Eilat. Crossing into Israel was yet another experience. The good thing: you know what to expect and that everything is pretty safe. The downside: “Please take everything out of the car.” We ask: “Well, we have accumulated quite a bit of trash and what about those engine-oil and gas canisters?” The reply was simple: “If we say everything, we mean everything.” . So they ended up x-raying our rubbish before we could throw it away.. At least it was good to clean out the car, and the customs officer was fascinated, too. He drove an extra round after the inspection because it was his first Mini.. After a late dinner on the red-sea we took off through the dessert - amazing star-gazing - and arrived in Rehovot (close to Tel Aviv) at two in the morning on x-mas day.

Image-Slideshow of the Road-trip

While Florian flew back to see his kid on x-mas just the day after we arrived, Carolina and me stayed 10 days in Tel Aviv, visiting friends, Yarriv's parents and grave. Toured to the dead-sea and Jerusalem; celebrated 2010 at a friend's place in Yafo; went swimming on new-years day.. in short we had a pretty good time: Israeli winter feels like a summer in Amsterdam (though Carolina says that BS. She says: “There is no summer in A'dam and the sea is much more clean and warm in Israel”).

After all the great experiences there had to go something wrong, right? Right. Due to snow chaos in Europe the flights were delayed.. My trip to Paris went pretty smooth after all, however my luggage got lost halfway. I still hope it will show up - it contains almost all my clothes, a hand-made Shisha from Syria and my digital camera - but it's already been 2 days without update on it. Carolina was even less lucky: After waiting 4 hours on board without starting she got a nice hotel-room in Tel Aviv, before going via Riga (yet another hotel) and Stockholm to Amsterdam.. Picture Gallery of excursions to the Dead-Sea and Jerusalem

reogg - Prepare audio-files for radio loops

Did you ever want to automate live audio streaming from the command-line? Well, I do. To cut it short the requirements here were:

  • command-line (terminal) only
  • generate one long stream - concatenate all songs
  • retain (id3) tags
  • stream Ogg/Vorbis to an icecast server

In principle one can simply concatenate OGG files and use oggfwd to send it to icecast. However most players (in particular mplayer) will produce garbled output when mixing OGG files with different bitrate/samplerate/channels in one stream. Furthermore some input files may not be OGG/Vorbis encoded in the first place.

To remedy the situation, here's a simple shell-script that converts all files in a given folder to a common format and copies over the id3 tags. You'll need to have oggenc, oggdec, mpg321, flac123 and id3tool installed.

You can download the script from the repository, but it's simple enough to be printed here:

view source

#  converts audio files in SRC folder to a common OGG format which allows to
#  concatenate the resulting files.


mkdir -p ${DST}
for file in $(ls ${SRC}); do
  echo "${file}" | grep -e "\.mp3$"  >/dev/null && DEC="mpg321 -q -w- "
  echo "${file}" | grep -e "\.ogg$"  >/dev/null && DEC="oggdec -Q -o- "
  echo "${file}" | grep -e "\.flac$" >/dev/null && DEC="flac123 -q -w- "

  test -z "${DEC}"         && continue;
  test -r "${SRC}/${file}" || continue;

  NFN=$(echo ${file} | sed 's/flac$/ogg/' | sed 's/mp3$/ogg/')

  echo "${file}" | grep -e "\.mp3$"  >/dev/null && \
  TAG=$(id3tool "${SRC}/${file}" \
        | sed 's/"/\\"/g' \
        | awk '/^Song Title/{printf "-t \"%s\" ",substr($0,13);}
               /^Artist/    {printf "-a \"%s\" ",substr($0,10);}
               /^Album/     {printf "-l \"%s\" ",substr($0,9);}
               /^Genre/     {printf "-G \"%s\" ",substr($0,9);}
               /^Track/     {printf "-N \"%s\" ",substr($0,9);}')

  echo "${file}" | grep -e "\.ogg$"  >/dev/null && \
  TAG=$(ogginfo "${SRC}/${file}" \
        | sed 's/"/\\"/g' \
        | awk 'BEGIN{IGNORECASE=1;}
               /Title=/      {printf "-t \"%s\" ",substr($0,8);}
               /Artist=/     {printf "-a \"%s\" ",substr($0,9);}
               /Album=/      {printf "-l \"%s\" ",substr($0,8);}
               /Genre=/      {printf "-G \"%s\" ",substr($0,8);}
               /Tracknumber=/{printf "-N \"%s\" ",substr($0,14);}')

  echo "#-- FILE: ${file}"
  CMD="$DEC \"${SRC}/${file}\""
  CMD+="| oggenc --resample 44100 -q 6 -o \"${DST}/${NFN}\" ${TAG} -"
  echo "${CMD}"
  eval $CMD || exit

To transmit the converted files repeatedly to an icecast server I run the following shell script in a GNU Screen:

view source


FILES=$(ls media/*.ogg)

function loopcat {
  while true; do
    # TODO: optionally randomize $FILES here..
    cat $FILES

while true; do
  loopcat \
  | oggfwd localhost 8000 password -p -g "Genre" -n "Title" -d "Description" mountpoint.ogg;
  echo "---- LOST CONNECTION ----"
  sleep 2

If you find these scripts useful or want to suggest some improvements.. drop me a word:

Thinkpad smapi and Realtime Linux

The tp_smapi driver provides for Battery charge/discharge control and improved stability for the HDAPS driver. However the latest version (as of writing 0.40) does not work with a real-time patched Linux-kernel.

The problem is that rt-linux uses a new mechanism for mutex-locking, which allows preemption and is incompatible with current Linux-mainline. In order to get the tp_smapi driver compile with rt-linux you need to replace the MUTEX locks. I came up with a simple patch that applies to tp_smapi 0.40 to just do that.

Tested with linux More information on tp_smapi can be found at


rt2460 and linux 2.6.31

As of linux 2.6.31 there is no mainline support for the Ralink rt2680 Wifi chipset. While there is an official driver provided by Ralinktech, it is incompatible with 2.6.31 due to the fact that post 2.6.29 the kernel's net_device_ops API has changed and 2.6.31 also removed CONFIG_COMPAT_NET_DEV_OPS backwards compatibility.

So I came up with a small patch to the Ralink driver.

The solution is to get the module source from (tested with version from 05/21/2009) and apply the patch before compilation..

Ralinktech provides a README file how to do this, basically you'll need the kernel-source or kernel-headers, and then simply type make after unzipping and patching the module source.

start.txt · Last modified: 22.02.2019 20:59 by rgareus