刺身の上にたんぽぽ乗せる日記

プログラミングしたり、自販機の下に落ちてる小銭を集めたりしてます

pulse audio raop設定 / alsa設定

http://raspberrypi.stackexchange.com/questions/5508/redirect-audio-to-another-airplay-device
にしたがってできたはずなんだけど、rebootしたら動かなくなってた...。
まずはpulse audioからraopで音を飛ばすところを確認する。

$ pulseaudio --log-level=debug -vvvv
(snip)
D: [raop-sink] module-raop-sink.c: Thread starting up
D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Device added for object /org/pulseaudio/core1/source1
D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Source added for object /org/pulseaudio/core1/source1
D: [pulseaudio] module-device-restore.c: Could not set format on sink raop.ipanema.local
D: [pulseaudio] module-suspend-on-idle.c: Sink raop.ipanema.local becomes idle, timeout in 5 seconds.
D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Device added for object /org/pulseaudio/core1/sink1
D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Sink added for object /org/pulseaudio/core1/sink1
I: [pulseaudio] module.c: Loaded "module-raop-sink" (index: #21; argument: "server=[169.254.171.141]:5000 sink_name=raop.ipanema.local sink_properties='device.description="ipanema"'").
D: [pulseaudio] protocol-dbus.c: Interface org.PulseAudio.Core1.Module added for object /org/pulseaudio/core1/module21
I: [pulseaudio] module-suspend-on-idle.c: Sink alsa_output.platform-bcm2835_AUD0.0.analog-stereo idle for too long, suspending ...
D: [pulseaudio] sink.c: Suspend cause of sink alsa_output.platform-bcm2835_AUD0.0.analog-stereo is 0x0004, suspending
I: [alsa-sink] alsa-sink.c: Device suspended...
D: [pulseaudio] core.c: Hmm, no streams around, trying to vacuum.
D: [pulseaudio] module-udev-detect.c: /dev/snd/controlC0 is accessible: yes
E: [pulseaudio] rtsp_client.c: Connection failed: Connection timed out
I: [pulseaudio] module-suspend-on-idle.c: Sink raop.ipanema.local idle for too long, suspending ...
D: [pulseaudio] sink.c: Suspend cause of sink raop.ipanema.local is 0x0004, suspending

もしやと思い

$ telnet 169.254.171.141 5000
Trying 169.254.171.141...

つながらず、macのほうでは

$ telnet 169.254.171.141 5000
Trying 169.254.171.141...
Connected to ipanema.local.
Escape character is '^]'.

試しにmacからping

$ ping ipanema.local
PING ipanema.local (192.168.0.38): 56 data bytes
64 bytes from 192.168.0.38: icmp_seq=0 ttl=255 time=5.395 ms

raspberry piからairmac expresstelnet

$ telnet 192.168.0.38 5000
Trying 192.168.0.38...
Connected to 192.168.0.38.
Escape character is '^]'.

avahiが胡散臭い。

pi@rpi ~ $ ping ipanema.local
PING ipanema.local (192.168.0.38) 56(84) bytes of data.
64 bytes from ipanema.local (192.168.0.38): icmp_req=1 ttl=255 time=0.761 ms
64 bytes from ipanema.local (192.168.0.38): icmp_req=2 ttl=255 time=0.801 ms
^C

      • ipanema.local ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 0.761/0.781/0.801/0.020 ms
pi@rpi ~ $ ping ipanema.local
PING ipanema.local (169.254.171.141) 56(84) bytes of data.
^C

      • ipanema.local ping statistics ---

7 packets transmitted, 0 received, 100% packet loss, time 6008ms

  • 立て続けでやると、二回目以降が何故かlink localのもので解決されるというのが問題らしい。
  • しょうがないからlink localのアドレスも割り振る。
    • force-bindはつけないと、普通のdefault routeあるせいか有効にならない。

pi@rpi ~ $ sudo avahi-autoipd eth0 --force-bind
Found user 'avahi-autoipd' (UID 111) and group 'avahi-autoipd' (GID 115).
Successfully called chroot().
Successfully dropped root privileges.
Starting with address 169.254.7.39
Callout BIND, address 169.254.7.39 on interface eth0
Received conflicting normal ARP packet.
Callout CONFLICT, address 169.254.7.39 on interface eth0
Trying address 169.254.204.240
Callout BIND, address 169.254.204.240 on interface eth0
Received conflicting normal ARP packet.
Callout CONFLICT, address 169.254.204.240 on interface eth0
Trying address 169.254.127.95
Callout BIND, address 169.254.127.95 on interface eth0
Received conflicting normal ARP packet.
Callout CONFLICT, address 169.254.127.95 on interface eth0
Trying address 169.254.99.123
Callout BIND, address 169.254.99.123 on interface eth0
Successfully claimed IP address 169.254.99.123

んで、ping

pi@rpi ~ $ ping ipanema.local
PING ipanema.local (192.168.0.38) 56(84) bytes of data.
64 bytes from ipanema.local (192.168.0.38): icmp_req=1 ttl=255 time=0.748 ms
64 bytes from ipanema.local (192.168.0.38): icmp_req=2 ttl=255 time=0.735 ms
^C

      • ipanema.local ping statistics ---

2 packets transmitted, 2 received, 0% packet loss, time 1000ms
rtt min/avg/max/mdev = 0.735/0.741/0.748/0.028 ms
pi@rpi ~ $ ping ipanema.local
PING ipanema.local (169.254.171.141) 56(84) bytes of data.
64 bytes from ipanema.local (169.254.171.141): icmp_req=1 ttl=255 time=1.47 ms
64 bytes from ipanema.local (169.254.171.141): icmp_req=2 ttl=255 time=0.703 ms

これやったけど、結局音出ない。
そもそもalsaで音出すのがまともに上手く行っていない。
http://raspberrypi.stackexchange.com/questions/639/how-to-get-pulseaudio-running

$ echo "play-file /usr/share/sounds/alsa/Front_Center.wav 0"|pacmd
Welcome to PulseAudio! Use "help" for usage information.

一応たまに音が出る。なんだこの糞は。