それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

AirPlayをLinuxで使いたいので、AirMac Express Client のインストールした

家に、3年前から転がってるこれを動かそうと一念発起した。

ウチにあるのは旧型

旧型なので11nは非対応だけど。それなりに楽しんでいる。しかしitunesのみというのが不便でならない。アンドロイド携帯になってipodとバイバイしたので、もてあました。

raop_playを使うとLinuxからたたける

raop_playやpluseAudioを使うと、Airmac Expressを使えるらしい。それは嬉しい。目覚まし時計として余生を過ごしていただこう。

色々調べてると、次のコマンドでインストール出来るっぽい

sudo aptitude install   \
        libssl0.9.8 libssl-dev libfltk1.1-dev libfltk1.1\
        fluid libglib2.0-dev libsamplerate0 \
        libsamplerate0-dev  libid3tag0  libid3tag0-dev
wget http://sourceforge.net/projects/raop-play/files/raop_play/raop_play-0.5.1/raop_play-0.5.1.tar.gz
tar zxvf raop_play-0.5.1.tar.gz
cd raop_play-0.5.1
./configure
make 
make install

Makeでこけたので。

http://ubuntuforums.org/showthread.php?t=743572
を参考にソースを書換

I can compile by making this patch to aexcl/ipod/glibsubst.c:

--- ../raop_play-0.5.1-original/aexcl/ipod/glibsubst.c 2005-12-16 06:17:00.000000000 -0800
+++ aexcl/ipod/glibsubst.c 2008-03-24 11:31:24.000000000 -0700
@@ -32,12 +32,12 @@
#include "aexcl_lib.h"


-inline gpointer g_malloc(gulong size)
+inline gpointer g_malloc(gsize size)
{
return malloc(size);
}

-inline gpointer g_malloc0(gulong size)
+inline gpointer g_malloc0(gsize size)
{
gpointer p;
if((p=malloc(size))) memset(p,0,size);

but the bigger problem is that the module still doesn't load.


Buildしたら成功。あとは普通に make && sudo make install

うまく行ったので、再生してみる。

takuya@KURO-BOX:~/raop_play-0.5.1$ cd
takuya@KURO-BOX:~$ raop_play 192.168.2.14 1.mp3
DBG: CSeq: 1
DBG: Apple-Response: hWENaKE4JrEn3q+Me5SjBaWV3N/jUH49gVwkeKX+tBkIMZ59oshJtaknBKIgaB3a78mY31ZF1sf6ZVUBhc6q0GY5GSNXD94XiVNWVd4xO0HzdrKhC5qQbrgu85lBChV0rINrRHqIuyCzHGWf7wNI2rg4FhI4lrfFnF/WNeFrbYGGHs6KfaaapWtcdYtfDI05GqkzffxfnH+4effZnGsQWgRYGRHbghOw3OLhCt68vphtdEj5g8Z+mVckyS+6rmrkp0cNREatobqRMSJBo0MYKCCPYdkqajKRCjcws11bJrQ7rot+n83kNsuY63UCMnX3oBeG9HaqxcEcPV+4+Z+DLw
DBG: Audio-Jack-Status: connected; type=digital
DBG: CSeq: 2
DBG: Session: 80A360C0
DBG: Transport: RTP/AVP/TCP;unicast;interleaved=0-1;mode=record;server_port=6000
DBG: Audio-Jack-Status: connected; type=digital
DBG: CSeq: 3
DBG: Audio-Jack-Status: connected; type=digital
DBG: CSeq: 4
DBG: Audio-Jack-Status: connected; type=digital
connected
DBG: id3 tagsize: 1756
DBG: sample rate=44100
ERR: decoder process can't be terminated
done
INFO: fd_event_callback: read, disconnected on the other end

だめだ。再生できない。decoder/decode関連のエラーらしい。プロセスを見渡して調べてみたり。

ふーむ。

開発もとをあらためて見直してみると。

  • To play mp3 data, mpg321 needs to be in the executable path.
  • To play ogg data, ogg123 needs to be in the executable path.
  • To play aac data, faad needs to be in the executable path.
  • To play flac data, flac needs to be in the executable path.
http://raop-play.sourceforge.net/


等と書いてある。

なるほど。mpg321が必要なのね。

aptitude insltall mpg321

再度再生

$ raop_play 192.168.2.111 sample.mp3
DBG: Audio-Jack-Status: connected; type=digital
DBG: CSeq: 2
DBG: Session: 80A360C0
DBG: Transport: RTP/AVP/TCP;unicast;interleaved=0-1;mode=record;server_port=6000
DBG: Audio-Jack-Status: connected; type=digital
DBG: CSeq: 3
DBG: Audio-Jack-Status: connected; type=digital
DBG: CSeq: 4
DBG: Audio-Jack-Status: connected; type=digital
connected
DBG: id3 tagsize: 1756
DBG: sample rate=44100
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layer 1, 2, and 3.
Version 0.59q (2002/03/23). Written and copyrights by Joe Drew.
Uses code from various people. See 'README' for more!
THIS SOFTWARE COMES WITH ABSOLUTELY NO WARRANTY! USE AT YOUR OWN RISK!
Title  : What 'bout my star? (Sheryl On  Artist: Sheryl Norm starring May'n
Album  : Macross Frontier Original Soun  Year  : 2008
Comment: #NIPPONSEI @ IRC.RIZON.NET      Genre : AnimeAnime

Playing MPEG stream from sample.mp3 ...
MPEG 1.0 layer III, 320 kbit/s, 44100 Hz stereo
n


-------------------------
big : 1
device->client_byte_format:2
device->driver_byte_format:1
--------------------------

[5:02] Decoding of sample.mp3 finished.
done
INFO: fd_event_callback: read, disconnected on the other end


無事再生できました。これで省エネな目覚まし時計が作れます。
連続再生するにはどうすれば・・・あとこれってMP3以外のストリームも流せるんじゃ・・・

追記

mpg321を入れる前のエラーが気になった。Processって書いてある。え、Process?

ERR: decoder process can't be terminated

再生中に、ps を見てみた

ps af | grep mpg
 3158 pts/1    Ss     0:04 /bin/bash
13737 pts/1    S+     2:15  \_ raop_play 192.168.2.14 1.mp3 1.mp3
13738 pts/1    S+     1:01      \_ mpg321 -s 1.mp3

やっぱり。。。mpg321がプロセスで起動してた。ほほほう。

mpg321のManを見てみると

  -s, --stdout Use standard output 
        instead of an audio device for output.
        Output is in 16-bit PCM, little-endian.

とある。raop_playはSTDOUT経由でPCMを受けているようだ。つまりRadikoの音声をこれに流せば聞けるって事かな。

raop_play でスピーカーを作ること

AirMac ExpressをAudio Output Deviceにする。


MacだとXRaop で、Rubyからも使える、Linuxだとraop_playだと思う。情報が少ないなぁ。マイナーデバイスって困るね。

http://www.makeuseof.com/tag/apples-airtunes-ubuntulinux/
http://www.hersson.net/projects/raopx
http://lifehacker.com/5623684/stream-audio-to-your-airport-express-speakers-in-linux



アップルコンピュータ AirMac Express ベースステーション with Air Tunes MB321J/A

アップルコンピュータ AirMac Express ベースステーション with Air Tunes MB321J/A