Switch to unified view

a/doc/sc2mpd.txt b/doc/sc2mpd.txt
...
...
2
2
3
The *sc2mpd* auxiliary process implements part of Linn *Songcast* support
3
The *sc2mpd* auxiliary process implements part of Linn *Songcast* support
4
for the *upmdcli* UPnP MPD front-end. Specifically, it implements a
4
for the *upmdcli* UPnP MPD front-end. Specifically, it implements a
5
*Songcast* _Receiver_ service, managed by *upmpdcli*.
5
*Songcast* _Receiver_ service, managed by *upmpdcli*.
6
6
7
To use it, you need the
8
link:http://www.linn.co.uk/software#songcast[Linn Songcast application] 
9
installed on a Microsoft Windows or Apple Mac OS X PC. See
10
xref:whatis_songcast[further] for more explanations about what this does.
11
7
*_This has mostly been tested with 16 bits sound but a recent change seems
12
*sc2mpd* has mostly been tested with 16 bits sound but a recent change
8
to have fixed 24 bits sound, so this should be now usable for MACs.  This
13
seems to have fixed 24 bits sound, so this should be now usable for
9
needs mpd 0.19 on the renderer. Still be a bit careful as this is quite new
14
MACs. *_This needs mpd 0.19 on the renderer. Do not try 24 bits sound with
10
and there is a risk of strange noises !_*
15
mpd 0.18 !_* (or turn the volume very low...). Using Songcast from a Mac (24
11
16
 bits audio) needs *mpd 0.19*, configured with `--disable-audiofile`.
12
*_Do not try 24 bits sound with MPD 0.18 !_* (or turn the volume very
13
low...). Using Songcast from a Mac (24 bits audio) needs *mpd 0.19*,
14
configured with `--disable-audiofile`.
15
16
As Debian and Ubuntu tend to lag quite bit on MPD progresses, I have setup 
17
As Debian and Ubuntu tend to lag quite bit on MPD progresses, I have set up 
17
link:downloads.html#mpd[backport repositories] for recent mpd versions
18
link:downloads.html#mpd[backport repositories] for recent mpd versions
18
(currently 0.19.9), for Ubuntu, Debian i386/amd64 and Raspbian.
19
(currently 0.19.9), for Ubuntu, Debian i386/amd64 and Raspbian.
19
20
20
*NEW: Debian packages for sc2mpd:* as the procedure for building sc2mpd is
21
And to conclude the misc warnings section: *there is no software volume
21
not completely obvious and automatic, I have also added *sc2mpd* packages
22
control* of the Songcast Receivers for now: use either a local mixer or the
22
to the *upmpdcli* Debian repository. Packages exist for architectures i386,
23
little round things on the power amps.
23
amd64 and Raspberry Pi. You can follow the procedure on the
24
link:downloads.html[upmpdcli download page] to add the repository, then
25
just use the following to install sc2mpd:
26
    
27
    sudo apt-get install sc2mpd
28
24
29
NOTE: For rebuilding from the source package: the installed binary has a
25
There are Debian Wheezy *sc2mpd*
30
static link to the OpenHome libraries. This means that, in order to rebuild
26
packages in the *upmpdcli* repository for i386, amd64 and Raspberry Pi
31
from the source package, you need to follow the normal procedure to build
27
(Raspbian): see the link:downloads.html[upmpdcli download page], so you do
32
the OpenHome libs first (see the ohbuild.sh script further down). The build
28
not need to build any software if you use these systems.
33
tree should be located under /opt/openhome for the package rebuild to work.
34
29
30
NOTE: you know what Songcast is and have a Rasberry PI which wants to play:
31
xref:rpi_quick[quick install for the Raspberry PI]  (also works for i386
32
and amd64 Debian Wheezy).
33
34
[[whatis_songcast]]
35
== What is Linn Songcast
35
== What is Linn Songcast
36
36
37
*Songcast* is a protocol for transporting audio streams across the network,
37
*Songcast* is a protocol for transporting audio streams across the network,
38
developped by link:http://oss.linn.co.uk/trac/wiki/Songcast[Linn] as a
38
developped by link:http://oss.linn.co.uk/trac/wiki/Songcast[Linn] as a
39
series of open-source libraries and applications.
39
series of open-source libraries and applications.
40
40
41
There are two types of entities involved in the protocol:
41
The protocol links two types of entities:
42
42
43
 - A *Songcast* _Sender_ generates an audio stream.
43
 - A *Songcast* _Sender_ generates an audio stream (Windows or Mac).
44
 - A *Songcast* _Receiver_, which typically runs on an OpenHome Renderer,
44
 - *Songcast* _Receivers_ receive and play the stream.
45
   receives the stream and plays it.
46
45
47
The streams transported by *Songcast* are actual real-time audio data, which
46
There are *Songcast* applications (_Senders_) for Windows and Mac OS X
48
can go straight to an audio card for playing.
47
(nothing for Linux, iOS or Android for now). The *Songcast* application
48
captures and forward the system audio stream to a remote *Songcast*
49
_Receiver_.
50
51
*Any* application on the desktop (Windows Media Player, Spotify, Tidal,
52
etc.) will transparently play to the remote device, without any need to
53
know about *Songcast*. *_Any_* audio service available on Windows or the
54
Mac can be forwarded to one or link:scmulti.html[many] audio players around
55
the house.
56
57
The *Songcast* streams are real-time audio data, which can go straight
58
to an audio card for playing.
49
59
50
Controlling the streams (connecting, starting, stopping) is
60
Controlling the streams (connecting, starting, stopping) is
51
done through an UPnP service named OpenHome __Receiver__, which runs on an
61
done through an UPnP service named OpenHome __Receiver__, which runs on an
52
UPnP Media Renderer implementing the OpenHome services.
62
UPnP Media Renderer implementing the OpenHome services (e.g. *upmpdcli*).
53
63
54
The typical use of *Songcast* is to have an audio driver on a Windows or OS X
55
desktop capture and forward the audio stream to a remote *Songcast* device
56
(this is the main purpose of the *Songcast* Mac and Windows applications,
57
apart from actually controlling the audio destination).
58
59
Any application on the desktop will (be compelled to) transparently play to
60
the remote device, without need to know anything about *Songcast*.
61
64
62
== Implementation of Songcast support in upmpdcli
65
== Implementation of Songcast support in upmpdcli
63
66
64
*upmpdcli* implements the _Receiver_ service, and uses an auxiliary process
67
*upmpdcli* implements the _Receiver_ service, and uses an auxiliary process
65
(*sc2mpd*) for transporting the audio data. *sc2mpd* is a slight
68
(*sc2mpd*) for transporting the audio data. *sc2mpd* is a slight
66
modification of the sample program which comes with the Linn Songcast
69
modification of the sample program which comes with the Linn Songcast
67
open-source implementation, with the addition of an HTTP interface (based
70
open-source implementation
68
on _libmicrohttpd_) to forward the data to *mpd*.
69
71
70
Setting up a connection happens as follows:
72
*sc2mpd* can play the audio stream in two modes:
73
74
 - By offering a local HTTP interface (based on _libmicrohttpd_) from which
75
   *mpd* will play the stream.
76
 - By directly using the *alsa* audio driver. *_This only works with 16
77
   bits sound for now (so only with a Windows sender, no Macs allowed)_*
78
79
What approach is used is decided by a parameter in the upmpdcli
80
configuration file: `scplaymethod` (see <<Configuration>> further)
71
 
81
 
82
Control:
83
72
- If it finds an executable *sc2mpd* command in the PATH when starting up,
84
- If *upmpdcli* finds an executable *sc2mpd* command in the PATH when
73
  *upmpdcli* advertises a _Receiver_ service.
85
  starting up, it advertises a _Receiver_ service.
74
86
75
- The Songcast implementation from the desktop finds out about the
87
- The *Songcast* application on the desktop finds out about the
76
  _Receiver_ through the normal UPnP mechanisms and can be instructed to
88
  _Receiver_ through the normal UPnP mechanisms and can be instructed to
77
  use it. It then tells the _Receiver_ in *upmpdcli* to start playing.
89
  use it. It then tells the _Receiver_ in *upmpdcli* to start playing.
78
90
79
- *upmdpcli* starts the *sc2mpd* process, which gets ready to receive data
91
- *upmdpcli* starts the *sc2mpd* process, which gets ready to receive data
80
  through Songcast, and make it available through HTTP.
92
  through Songcast, and either play it directly or make it available
93
  through HTTP.
81
94
82
 *upmpdcli* instructs *mpd* to play the URL for the *sc2mpd* output.
95
- If the _`mpd`_ method is in use, *upmpdcli* instructs *mpd* to play the
96
  URL for the *sc2mpd* output.
83
97
84
There is currently a 10-12 S delay between the connection request and the
98
When using _`mpd`_ more bufferisation occurs and there may be a significant
85
moment the audio starts playing. This is not normal, but I could not find
99
delay (up to around 10S) between the time when Songcast is activated and
86
the reason for it, so it's an unavoidable inconvenience at the moment.
100
the time sound appears. 
87
101
102
Given the bufferisation and delay control issues when going through MPD,
103
only the _`alsa`_ method is usable in multi-room configurations. Even with a
104
single player, the _`mpd`_ method will experience skips from time to
105
time. The reasons are explained in the link:scmulti.html[multi-room]
106
page.
107
108
109
[[rpi_quick]]
110
== Quick install for Debian Wheezy systems
111
112
There are packages available for Raspbian and Debian Wheezy i386 and amd64.
113
114
So add the repositories:
115
116
    echo deb http://www.lesbonscomptes.com/upmpdcli/downloads/debian/ unstable main | sudo tee /etc/apt/sources.list.d/upmpdcli.list 
117
    echo deb-src http://www.lesbonscomptes.com/upmpdcli/downloads/debian/ unstable main | sudo tee -a /etc/apt/sources.list.d/upmpdcli.list 
118
    echo deb http://www.lesbonscomptes.com/upmpdcli/downloads/mpd-debian/ unstable main  | sudo tee -a /etc/apt/sources.list.d/upmpdcli.list 
119
    echo deb-src http://www.lesbonscomptes.com/upmpdcli/downloads/mpd-debian/ unstable main  | sudo tee -a /etc/apt/sources.list.d/upmpdcli.list 
120
121
Install (the mpd and libupnp versions in the repo have bug fixes):
122
123
    sudo apt-get update 
124
    sudo apt-get install upmpdcli sc2mpd mpd libupnp6
125
126
And seed the next section for configuring.
127
128
[[Configuration]]
88
== Configuration
129
== Configuration
89
130
131
=== On the Receiver side
90
No configuration is necessary by default: if *sc2mpd* is present,
132
No configuration is necessary by default: if *sc2mpd* is present,
91
*upmpdcli* will advertise the Songcast capability, and any host with a
133
*upmpdcli* will advertise the Songcast capability, and any host with a
92
Songcast sender installed should be able to use it.
134
Songcast sender installed should be able to use it.
93
135
94
However, you can set a number of values in the upmpdcli configuration file
136
However, you can set a number of values in the upmpdcli configuration file
95
(you *must* set the *upmpdcli* `-c` option for *sc2mpd* to see them, the
137
(you *must* set the *upmpdcli* `-c` option for *sc2mpd* to see them, the
96
environment variable will not work):
138
environment variable will not work):
97
139
140
scplaymethod:: 
141
This decides how audio is played, with 2 possible
142
values, _`alsa`_ or _`mpd`_. Using _`mpd`_ is somewhat easier, but
143
unusable in link:scmulti.html[multi-room] configurations, and you risk
144
small drops even in single-player settings.
145
146
scalsadevice:: 
147
If the _`alsa`_ method is set, the `scalsadevice`
148
parameter defines the interface name. Use `aplay -L` to find the
149
appropriate name. Also check that user _`upmpdcli`_ belongs to the
150
_`audio`_ group.
151
98
sclogfilename:: 
152
sclogfilename:: 
99
Name of the file which will receive *sc2mpd* log messages. `stderr` by
153
Name of the file which will receive *sc2mpd* log messages. `stderr` by
100
default. This _can't be_ the same file used by *upmpdcli*.
154
default. This _can't be_ the same file used by *upmpdcli*.
101
155
102
scloglevel:: 
156
scloglevel:: 
103
Log verbosity.  
157
Log verbosity.  
104
158
105
schttpport:: 
159
schttpport:: 
106
160
If the _`mpd`_ method is set, this defines the HTTP port used by *mpd* to
107
HTTP port used by *mpd* to connect to *sc2mpd*. 8888 by default. This must
161
connect to *sc2mpd*. 8768 by default. This must be an available port on
108
be an available port on `localhost`, and it will only accept connections from
162
`localhost`, and it will only accept connections from `localhost`.
109
`localhost`.
110
163
111
sc2mpd:: 
164
sc2mpd:: 
112
Path for the *sc2mpd* executable file (e.g. `/usr/local/bin/sc2mpd`). Only
165
Path for the *sc2mpd* executable file (e.g. `/usr/local/bin/sc2mpd`). Only
113
useful if *sc2mpd* was not installed to a location in the executable $PATH
166
useful if *sc2mpd* was not installed to a location in the executable $PATH
114
set for the init scripts. Typically only `/bin` and `/usr/bin` are in
167
set for the init scripts. Typically only `/bin` and `/usr/bin` are in
115
there.
168
there. This allows *upmpdcli* to find *sc2mpd* if it is not in the standard
169
location.
170
171
=== On the Sender (Windows/Mac) side
172
173
I could not get IP multicast to work with WIFI Receivers (the sound drops
174
constantly).
175
176
There are well-known problems with multicast and WIFI (see for example
177
http://superuser.com/questions/730288/why-do-some-wifi-routers-block-multicast-packets-going-from-wired-to-wireless[this
178
superuser.com question] 
179
for detailed explanations). This seems to be dependant on the WIFI hardware
180
(router/access points) used, so maybe you will have more luck than me.
181
182
If some of your Receivers use WIFI, and you experience sound issues, check
183
that "Unicast" is selected in the Songcast configuration "advanced" panel
184
on the desktop.
185
186
Under most conditions, WIFI data rates should be more than sufficient to
187
transport Songcast streams (a bit over 1 Mbit/S for 48k/24bits, 700 Kbits/S
188
for 44.1k/16 bits).
116
189
117
== Building sc2mpd
190
== Building sc2mpd
118
191
119
There are two parts in building *sc2mpd*:
192
There are two parts in building *sc2mpd*:
120
193
121
- Building the Openhome libraries
194
- Building the Openhome libraries
122
- Building *sc2mpd* proper
195
- Building *sc2mpd* proper
123
196
124
First clone the *sc2mpd* Github repository:
197
First download a
198
link:http://www.lesbonscomptes.com/upmpdcli/downloads.html[*sc2mpd*
199
release] or clone the *sc2mpd*
125
http://www.github.com/medoc92/sc2mpd.
200
link:http://www.github.com/medoc92/sc2mpd[Github repository]. 
126
201
127
*sc2mpd* depends on the microhttpd library. Install the development and
202
*sc2mpd* depends on a number of libraries:
128
runtime packages which are currently named _libmicrohttpd-dev_ and
129
_libmicrohttpd10_ on Debian-derived systems (use _libmicrohttpd_ and
130
_libmicrohttpd-devel_ for Fedora).
131
203
204
- The link:http://www.gnu.org/software/libmicrohttpd/[microhttpd]
205
  library. Install the development and runtime packages which are currently
206
  named _libmicrohttpd-dev_ and _libmicrohttpd10_ on Debian-derived systems
207
  (use _libmicrohttpd_ and _libmicrohttpd-devel_ for Fedora).
208
- The link:http://www.mega-nerd.com/SRC/[libsamplerate]
209
  library. _libsamplerate0_ on debian-derived systems.
210
- The *libasound* Alsa interface library (_libasound2_).
132
211
133
Building the Openhome libraries is a bit of a black art, and the *sc2mpd*
212
Building the Openhome libraries is a bit of a black art, and the *sc2mpd*
134
source comes with an _ohbuild.sh_ script which will try to clone the
213
source comes with an _ohbuild.sh_ script which will try to clone the
135
Openhome Git repositories and build the libs:
214
Openhome Git repositories and build the libs:
136
215
...
...
150
    make
229
    make
151
    sudo make install
230
    sudo make install
152
231
153
The build uses static Openhome libraries, so you can move the executable to
232
The build uses static Openhome libraries, so you can move the executable to
154
another machine without needing the Openhome directory (don't forget to
233
another machine without needing the Openhome directory (don't forget to
155
install the _libmicrohttpd_ runtime though).
234
install the _libmicrohttpd_, _libsamplerate_ and _libasound_ runtimes
235
though).
156
236
157
After restarting *upmpdcli*, it should advertise the _Receiver_ service and
237
After restarting *upmpdcli*, it should advertise the _Receiver_ service and
158
appear in the Songcast Sender menus.
238
appear in the Songcast Sender menus.
159
239
160
== Miscellaneous remarks
240
== Miscellaneous remarks