Using a bluetooth headset for giving presentations

While looking for ways of flipping slides while not near the computer, I stumbled on this idea this idea, bought a cheap headset for like 10euros and started playing.

Getting the headset to work with alsa

It's supposed to just work, but bluez-utils in Debian has audio support disabled.

I've rebuild the package with the patch found in the bug report, copied the extra configuration files as I mentioned in a followup to the bug report, and brought my Debian up to speed.

Once the patched bluez-utils is in place, this is how to get the headset to work:

  1. put the headset into pairing mode
  2. hcitool scan (to get the address of the headset)
  3. put this in ~/.asoundrc (using the address you got with hcitool scan):
    pcm.bluetooth_hw {
       type bluetooth
       device 00:11:22:33:44:55
    }
    
    ctl.bluetooth {
       type bluetooth
       device 00:11:22:33:44:55
    }
    
    # No idea why this is needed, but it makes aplay complain a bit
    # less, and also it makes aoss work
    pcm.bluetooth {
        type plug
        slave.pcm "bluetooth_hw"
    }
    

Now, forget hcitool cc: in order to pair with the headset, the command is:

mplayer -ao alsa:device=bluetooth moo.wav

This will trigger a funky chain of events that will eventually cause the bluetooth applet to ask you for the pin (0000 for the headsets), get things paired and activate super cow powers.

Now you have an alsa sound card called 'bluetooth' that works only with some, but not all, alsa applications. mplayer works. aoss works, but not always. aplay seems to work. twinkle won't work; apparently, it's because it tries to open the device multiple times.

Feeding synthesised speech to the headset

Synthesised speech is done by festival. Festival works with oss. The headset works with alsa. aoss works, but not always.

This is the script I'd like to run:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#!/bin/sh

warn() {
    echo -n "Attenzione: "
    if [ $1 == 1 ]
    then
        echo -n "manca un minuto"
    else
        echo -n "mancano $1 minuti"
    fi
    echo " alla fine."
}

(
    for x in 5 4 3 2 1
    do
        warn $x
        sleep 1
    done
) | festival --tts --language italian

By tweaking the sleep times and numbers a bit, it's a useful prototype that sends updates on how much time is left for the presentation.

This, under aoss, does not work reliably. An alternative is to replace the festival invocation with this:

echo string | text2wave tmpfile.wav
mplayer -ao alsa:device=bluetooth tmpfile.wav

However, I found no way to tell text2wave to use Italian instead of English.

I did manage, however, to get some link between festival and the headphones. At a further stage, I can write a program for the countdown that keeps the audio device open and every once in a while gets a waveform out of text2wave and feeds it to the audio device.

Keeping the audio device open seems a good idea, to avoid losing the beginning of the message while the connection is established (happens with my cheap headset) and to avoid the headset to go idle and switch off.

Reacting to the buttons on the headset

It's supposed to be possible, but I didn't manage to find out how to do this using the normal alsa driver, now that btsco is apparently deprecated.

Once I find out how to be notified of button presses, I'll try to see how to send a Page Down keystroke to OpenOffice Impress or xpdf.

Voice commands

sphinx2-bin seems promising, but since everyone around me is now asleep, playing with voice commands has to be postponed.

Further ideas