Is sharing sound of mplayer output and speech-dispatcher to bluetooth device possible?

Lothar Behrens lothar.behrens at lollisoft.de
Sun Dec 6 13:38:03 CET 2009


Hi,

I would again ask if there has been any success to let navit speak to  
bluetooth headset?

Or if anyone has got speech-dispatcher to use bluetooth device.

I am able to play sound (mplayer + pm3 files) to A2DP. But I am not  
sure if both would work (when navit will speak, mplayer should pause).

Below, you will see how I start playing mp3 files over A2DP.

May it only missing something to do the same for navit?
Could I share playing mp3 and navit speech?
Can I extend the setup to also support redirecting speech-dispatcher  
output to bluetooth?

Is eventually kill -STOP <mplayer>, spd-say ..., kill -CONT <mplayer>  
an option to recognize navit saying something?

Start playing my playlist (random)

#!/bin/sh
killall -SIGQUIT mplayer

/home/root/setup-bluetooth-audio.sh
rm playlist-sorted.m3u
rm playlist.m3u
find /media/card/Musik -name "*.mp3" > /home/root/playlist-sorted.m3u
/home/root/scramble.py /home/root/playlist-sorted.m3u > /home/root/ 
playlist.m3u

mplayer -ao alsa:device=bluetooth -playlist /home/root/playlist.m3u &

sleep 3
# Helps a little bit to avoid 'gaps' in the voice. But not all  
problems are gone. Especially in car (when it is very hot) the 'gaps'  
reappear??
renice -19 `ps ax | grep mplayer | grep -Ev "grep|Unknown" | awk --  
'BEGIN {}{ print $1;}'`
renice -19 `ps ax | grep kmmcd | grep -Ev "grep|Unknown" | awk --  
'BEGIN {}{ print $1;}'`
renice -19 `ps ax | grep -E "SDIO Helper" | grep -Ev "grep|Unknown" |  
awk -- 'BEGIN {}{ print $1;}'`


#scramble.py
#!/usr/bin/env python
import sys, random
filename = sys.argv[1]
a = open(filename).read().strip().split("\n")
random.shuffle(a)
for i in a:
     print i


#/home/root/setup-bluetooth-audio.sh
!/bin/sh

export DEVICE=00:1D:82:04:AA:40

/etc/init.d/bluetooth stop
/etc/init.d/bluetooth start

sleep 1
passkey-agent --default 0000 &

/home/root/SetHeadSetDefault.py

#/home/root/SetHeadSetDefault.py
!/usr/bin/python
import dbus
bus = dbus.SystemBus()
manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),  
'org.bluez.Manager')
conn = manager.ActivateService('audio')
audio = dbus.Interface(bus.get_object(conn, '/org/bluez/audio'),  
'org.bluez.audio.Manager')
path = audio.CreateDevice('00:1D:82:04:AA:40')
audio.ChangeDefaultDevice(path)
print path
sink = dbus.Interface(bus.get_object(conn, path),  
'org.bluez.audio.Sink')
sink.Connect()

It would be a nice feature :-)

Thanks

Lothar

Am 18.02.2009 um 14:18 schrieb Lothar Behrens:

> See below...
>
> Am 15.02.2009 um 22:45 schrieb Rask Ingemann Lambertsen:
>
>> On Thu, Jan 22, 2009 at 09:38:41PM +0100, Lothar Behrens wrote:
>>> Has no one got the output of speech-dispatcher into a bouetooth  
>>> headset ?
>>>
>>> Using mplayer -ao alsa:device=bluetooth works, but not spd-say. It
>>> always comes out of the speaker.
>>
>>   What does the speech-dispatcher documentation say about selecting  
>> a sound
>> card for output?
>
> I havent found anyting usefull in the documentation or in the  
> configuration files.
>
>>
>>
>>   Also try some of the stuff from the wiki:
>> http://wiki.openmoko.org/wiki/ 
>> Neo_1973_audio_subsystem#Driver_Status_3
>>
>>   Specifically these:
>>
>> http://wiki.openmoko.org/images/3/3d/Btcpu_gta02.state.txt
>> http://handheldshell.com/bluetooth_pcm
>> http://opensource.wolfsonmicro.com/~gg/bluetooth-pcm/bluetooth_pcm.c
>>
>>   Usage would be something like this:
>>
>> $ alsactl restore -f Btcpu_gta02.state.txt
>> $ ./bluetooth_pcm &
>> [play some sound here]
>
> using 'spd-say Hello' doesn't plays anything on my BT device.
>
>>
>> $ killall bluetooth_pcm
>>
>
> Here it plays again on the internal speaker.
>
>>   The interesting controls of the state file are these:
>>
>> 20 'Sidetone Capture Volume' -> 0 (increase as needed).
>> 64 'Capture Right Mux' -> 'Sidetone' to route playback mixer sound  
>> into right ADC.
>> 66 'Capture Right Mixer' -> 'Analogue Mix Right' to record right  
>> channel
>>   from right ADC.
>> 67 'Capture Left Mixer' -> 'Analogue Mix Right' to record left  
>> channel
>>   also from right ADC.
>> 68 'Playback Mixer Voice Capture Sw' -> false to not mix GSM output  
>> into the
>>   sidetone.
>> 69 'Playback Mixer Left Capture Swi' -> true to mix left output  
>> into the
>>   sidetone.
>> 70 'Playback Mixer Right Capture Sw' -> true to mix right output  
>> into the
>>   sidetone.
>>
>> (Maybe look at control 22 'Capture Volume' too?)
>>
>
> Are the settings for the state file above working for you playing  
> 'spd-say Hello' without modifying the contents from that link ?
>
> After looking into the code, is there a need for modifying the  
> device respect to my neo ?
>
> This is because I call the following python script before I start  
> mplayer with bt support.
>
> #!/usr/bin/python
> import dbus
> bus = dbus.SystemBus()
> manager = dbus.Interface(bus.get_object('org.bluez', '/org/bluez'),  
> 'org.bluez.Manager')
> conn = manager.ActivateService('audio')
> audio = dbus.Interface(bus.get_object(conn, '/org/bluez/audio'),  
> 'org.bluez.audio.Manager')
> path = audio.CreateDevice('00:1D:82:04:AA:40')
> audio.ChangeDefaultDevice(path)
> print path
> sink = dbus.Interface(bus.get_object(conn, path),  
> 'org.bluez.audio.Sink')
> sink.Connect()
>
>
> Lothar
>
> -- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
> Lothar Behrens
> Heinrich-Scheufelen-Platz 2
> 73252 Lenningen
>
>
>
>
>
>
>
>
>
> _______________________________________________
> Openmoko community mailing list
> community at lists.openmoko.org
> http://lists.openmoko.org/mailman/listinfo/community

-- | Rapid Prototyping | XSLT Codegeneration | http://www.lollisoft.de
Lothar Behrens
Heinrich-Scheufelen-Platz 2
73252 Lenningen











More information about the community mailing list