[docs] Delete "old" README*.md files

This commit is contained in:
chme 2022-03-20 12:36:25 +01:00
parent 56da181959
commit f991d9ddf9
13 changed files with 13 additions and 4579 deletions

View File

@ -1,354 +1,3 @@
# Installation instructions for OwnTone
This document contains instructions for installing OwnTone from the git tree. If
you just want to install from a release tarball, you don't need the build tools
(git, autotools, autoconf, automake, gawk, gperf, gettext, bison and flex), and
you can skip the autoreconf step.
The source for this version of OwnTone can be found here:
[owntone/owntone-server](https://github.com/owntone/owntone-server.git)
## Quick version for Raspberry Pi OS
See the instructions here:
[OwnTone server (iTunes server) -
Raspberry Pi Forums](http://www.raspberrypi.org/phpBB3/viewtopic.php?t=49928)
## Quick version for Debian/Ubuntu users
If you are the lucky kind, this should get you all the required tools and
libraries:
```bash
sudo apt-get install \
build-essential git autotools-dev autoconf automake libtool gettext gawk \
gperf bison flex libconfuse-dev libunistring-dev libsqlite3-dev \
libavcodec-dev libavformat-dev libavfilter-dev libswscale-dev libavutil-dev \
libasound2-dev libmxml-dev libgcrypt20-dev libavahi-client-dev zlib1g-dev \
libevent-dev libplist-dev libsodium-dev libjson-c-dev libwebsockets-dev \
libcurl4-openssl-dev libprotobuf-c-dev
```
Note that OwnTone will also work with other versions and flavours of
libgcrypt and libcurl, so the above are just suggestions.
The following features require extra packages, and that you add a configure
argument when you run ./configure:
Feature | Configure argument | Packages
---------------------|--------------------------|-------------------------------------
Chromecast | `--enable-chromecast` | libgnutls*-dev
Legacy libspotify | `--enable-libspotify` | libspotify-dev
Pulseaudio | `--with-pulseaudio` | libpulse-dev
These features can be disabled saving you package dependencies:
Feature | Configure argument | Packages
---------------------|--------------------------|-------------------------------------
Spotify (built-in) | `--disable-spotify` | libprotobuf-c-dev
Player web UI | `--disable-webinterface` | libwebsockets-dev
Live web UI | `--without-libwebsockets`| libwebsockets-dev
Then run the following (adding configure arguments for optional features):
```bash
git clone https://github.com/owntone/owntone-server.git
cd owntone-server
autoreconf -i
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user
make
sudo make install
```
Using `--enable-install-user` means that `make install` will also add system
user and group for owntone.
With the above configure arguments, a systemd service file will be installed to
`/etc/systemd/system/owntone.service` so that the server will start on boot.
Use `--disable-install-systemd` if you don't want that.
Now edit `/etc/owntone.conf`. Note the guide at the top highlighting which
settings that normally require modification.
Start the server with `sudo systemctl start owntone` and check that it is
running with `sudo systemctl status owntone`.
See the [README.md](README.md) for usage information.
## Quick version for Fedora
If you haven't already enabled the free RPM fusion packages do that, since you
will need ffmpeg. You can google how to do that. Then run:
```bash
sudo yum install \
git automake autoconf gettext-devel gperf gawk libtool bison flex \
sqlite-devel libconfuse-devel libunistring-devel mxml-devel libevent-devel \
avahi-devel libgcrypt-devel zlib-devel alsa-lib-devel ffmpeg-devel \
libplist-devel libsodium-devel json-c-devel libwebsockets-devel \
libcurl-devel protobuf-c-devel
```
Clone the OwnTone repo:
```bash
git clone https://github.com/owntone/owntone-server.git
cd owntone-server
```
Then run the following:
```bash
autoreconf -i
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user
make
sudo make install
```
Using `--enable-install-user` means that `make install` will also add system
user and group for owntone.
With the above configure arguments, a systemd service file will be installed to
`/etc/systemd/system/owntone.service` so that the server will start on boot.
Use `--disable-install-systemd` if you don't want that.
Now edit `/etc/owntone.conf`. Note the guide at the top highlighting which
settings that normally require modification.
Start the server with `sudo systemctl start owntone` and check that it is
running with `sudo systemctl status owntone`.
See the [README.md](README.md) for usage information.
## Quick version for FreeBSD
There is a script in the 'scripts' folder that will at least attempt to do all
the work for you. And should the script not work for you, you can still look
through it and use it as an installation guide.
## Quick version for macOS (using Homebrew)
This workflow file used for building OwnTone via Github actions includes
all the steps that you need to execute:
[.github/workflows/macos.yml](.github/workflows/macos.yml)
## "Quick" version for macOS (using macports)
Caution:
1) this approach may be out of date, consider using the Homebrew method above
since it is continuously tested.
2) macports requires many downloads and lots of time to install (and sometimes
build) ports... you'll want a decent network connection and some patience!
Install macports (which requires Xcode):
https://www.macports.org/install.php
```bash
sudo port install \
autoconf automake libtool pkgconfig git gperf bison flex libgcrypt \
libunistring libconfuse ffmpeg libevent json-c libwebsockets curl \
libplist libsodium protobuf-c
```
Download, configure, build and install the Mini-XML library:
http://www.msweet.org/projects.php/Mini-XML
Download, configure, build and install the libinotify library:
https://github.com/libinotify-kqueue/libinotify-kqueue
Add the following to `.bashrc`:
```bash
# add /usr/local to pkg-config path
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/opt/local/lib/pkgconfig
# libunistring doesn't support pkg-config, set overrides
export LIBUNISTRING_CFLAGS=-I/opt/local/include
export LIBUNISTRING_LIBS="-L/opt/local/lib -lunistring"
```
Optional features require the following additional ports:
Feature | Configure argument | Ports
--------------------|--------------------------|-------------------
Chromecast | `--enable-chromecast` | gnutls
Pulseaudio | `--with-pulseaudio` | pulseaudio
Clone the OwnTone repo:
```bash
git clone https://github.com/owntone/owntone-server.git
cd owntone-server
```
Finally, configure, build and install, adding configure arguments for
optional features:
```bash
autoreconf -i
./configure
make
sudo make install
```
Note: if for some reason you've installed the avahi port, you need to
add `--without-avahi` to configure above.
Edit `/usr/local/etc/owntone.conf` and change the `uid` to a nice
system daemon (eg: unknown), and run the following:
```bash
sudo mkdir -p /usr/local/var/run
sudo mkdir -p /usr/local/var/log # or change logfile in conf
sudo chown unknown /usr/local/var/cache/owntone # or change conf
```
Run OwnTone:
```bash
sudo /usr/local/sbin/owntone
```
Verify it's running (you need to <kbd>Ctrl</kbd>+<kbd>C</kbd> to stop
dns-sd):
```bash
dns-sd -B _daap._tcp
```
## Long version - requirements
Required tools:
- autotools: autoconf 2.63+, automake 1.10+, libtool 2.2. Run `autoreconf -i`
at the top of the source tree to generate the build system.
- gettext: libunistring requires iconv and gettext provides the autotools
macro definitions for iconv.
- gperf
- bison 3.0+ (yacc is not sufficient)
- flex (lex is not sufficient)
Libraries:
- Avahi client libraries (avahi-client), 0.6.24 minimum
from <http://avahi.org/>
- sqlite3 3.5.0+ with unlock notify API enabled (read below)
from <http://sqlite.org/download.html>
- ffmpeg (libav)
from <http://ffmpeg.org/>
- libconfuse
from <http://www.nongnu.org/confuse/>
- libevent 2.0+ (best with 2.1.4+)
from <http://libevent.org/>
- MiniXML (aka mxml or libmxml)
from <http://minixml.org/software.php>
- gcrypt 1.2.0+
from <http://gnupg.org/download/index.en.html#libgcrypt>
- zlib
from <http://zlib.net/>
- libunistring 0.9.3+
from <http://www.gnu.org/software/libunistring/#downloading>
- libjson-c
from <https://github.com/json-c/json-c/wiki>
- libcurl
from <http://curl.haxx.se/libcurl/>
- libplist 0.16+
from <http://github.com/JonathanBeck/libplist/downloads>
- libsodium
from <https://download.libsodium.org/doc/>
- libprotobuf-c
from <https://github.com/protobuf-c/protobuf-c/wiki>
- libasound (optional - ALSA local audio)
often already installed as part of your distro
- libpulse (optional - Pulseaudio local audio)
from <https://www.freedesktop.org/wiki/Software/PulseAudio/Download/>
- libspotify (optional - Spotify support)
(deprecated by Spotify)
- libgnutls (optional - Chromecast support)
from <http://www.gnutls.org/>
- libwebsockets 2.0.2+ (optional - websocket support)
from <https://libwebsockets.org/>
If using binary packages, remember that you need the development packages to
build OwnTone (usually named -dev or -devel).
sqlite3 needs to be built with support for the unlock notify API; this isn't
always the case in binary packages, so you may need to rebuild sqlite3 to
enable the unlock notify API (you can check for the presence of the
sqlite3_unlock_notify symbol in the sqlite3 library). Refer to the sqlite3
documentation, look for `SQLITE_ENABLE_UNLOCK_NOTIFY`.
## Long version - building and installing
Start by generating the build system by running `autoreconf -i`. This will
generate the configure script and `Makefile.in`.
To display the configure options `run ./configure --help`.
Support for Spotify is optional. Use `--disable-spotify` to disable this feature.
OwnTone supports two ways of integrating with Spotify: Using its own, built-in
integration layer (which is the default), or to use Spotify's deprecated
libspotify. To enable the latter, you must configure with `--enable-libspotify`
and also make sure libspotify's `libspotify/api.h` is installed at compile time.
At runtime, libspotify must be installed, and `use_libspotify` must be enabled
in owntone.conf. OwnTone uses runtime dynamic linking to the libspotify library,
so even though you compiled with `--enable-libspotify`, the executable will
still be able to run on systems without libspotify. If you only want libspotify
integration, you can use `--disable-spotify` and `--enable-libspotify`.
Support for LastFM scrobbling is optional. Use `--enable-lastfm` to enable this
feature.
Support for the MPD protocol is optional. Use `--disable-mpd` to disable this
feature.
Support for Chromecast devices is optional. Use `--enable-chromecast` to enable
this feature.
The player web interface is optional. Use `--disable-webinterface` to disable
this feature.
If enabled, `sudo make install` will install the prebuild html, js, css files.
The prebuild files are:
- `htdocs/index.html`
- `htdocs/player/*`
The source for the player web interface is located under the `web-src` folder and
requires nodejs >= 6.0 to be built. In the `web-src` folder run `npm install` to
install all dependencies for the player web interface. After that run `npm run build`.
This will build the web interface and update the `htdocs` folder.
(See [README_PLAYER_WEBINTERFACE.md](README_PLAYER_WEBINTERFACE.md) for more
informations)
Building with libwebsockets is required if you want the web interface. It will be enabled
if the library is present (with headers). Use `--without-libwebsockets` to disable.
Building with Pulseaudio is optional. It will be enabled if the library is
present (with headers). Use `--without-pulseaudio` to disable.
Recommended build settings:
```bash
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --enable-install-user
```
After configure run the usual make, and if that went well, `sudo make install`.
With the above configure arguments, a systemd service file will be installed to
`/etc/systemd/system/owntone.service` so that the server will start on boot.
Use `--disable-install-systemd` if you don't want that.
Using `--enable-install-user` means that `make install` will also add a system
user and group for owntone.
After installation:
- edit the configuration file, `/etc/owntone.conf`
- make sure the Avahi daemon is installed and running (Debian:
`apt install avahi-daemon`)
OwnTone will drop privileges to any user you specify in the configuration file
if it's started as root.
This user must have read permission to your library and read/write permissions
to the database location (`$localstatedir/cache/owntone` by default).
Instructions on how to install OwnTone can be found at <https://owntone.github.io/owntone-server/installation/>

View File

@ -23,12 +23,14 @@ dist_man_MANS = owntone.8
nobase_dist_doc_DATA = \
UPGRADING \
README.md \
README_JSON_API.md \
README_PULSE.md \
README_ALSA.md \
README_SMARTPL.md \
README_PLAYER_WEBINTERFACE.md \
README_RADIO_STREAMS.md \
docs/index.md \
docs/documentation.md \
docs/installation.md \
docs/outputs-pulse.md \
docs/outputs-alsa.md \
docs/smart-playlists.md \
docs/web-interface.md \
docs/radio-streams.md \
scripts/pairinghelper.sh
EXTRA_DIST = \

604
README.md
View File

@ -17,606 +17,10 @@ mt-daapd (Firefly Media Server).
## Looking for help?
Before you continue, make sure you know what version of OwnTone you have,
and what features it was built with (e.g. Spotify support).
How to find out? Go to the [web interface](http://owntone.local:3689) and
check. No web interface? Then check the top of the log file (usually
/var/log/owntone.log).
Note that you are viewing a snapshot of the instructions that may or may not
match the version that you are using. Go to [references](#references) to find
instructions for previous versions.
Visit the [OwnTone documentation](https://owntone.github.io/owntone-server/installation/) for
usage and set up instructions, API documentation, etc.
If you are looking for help on building OwnTone (not using it), then
please see the [INSTALL.md](INSTALL.md) file.
please see the [Installation](https://owntone.github.io/owntone-server/installation/)
instructions.
## Contents
- [Getting started](#getting-started)
- [Supported clients](#supported-clients)
- [Web interface](#web-interface)
- [Using Remote](#using-remote)
- [AirPlay devices/speakers](#airplay-devicesspeakers)
- [Chromecast](#chromecast)
- [Local audio through ALSA](#local-audio-through-alsa)
- [Local audio, Bluetooth and more through Pulseaudio](#local-audio-bluetooth-and-more-through-pulseaudio)
- [MP3 network streaming (streaming to iOS)](#mp3-network-streaming-streaming-to-ios)
- [Remote access](#remote-access)
- [Supported formats](#supported-formats)
- [Playlists and internet radio](#playlists-and-internet-radio)
- [Artwork](#artwork)
- [Library](#library)
- [Command line](#command-line)
- [Spotify](#spotify)
- [LastFM](#lastfm)
- [MPD clients](#mpd-clients)
- [Running Multiple Instances](#running-multiple-instances)
- [References](#references)
## Getting started
After installation (see [INSTALL.md](INSTALL.md)) do the following:
1. Edit the configuration file (usually `/etc/owntone.conf`) to suit your
needs
2. Start or restart the server (usually `/etc/init.d/owntone restart`)
3. Go to the web interface [http://owntone.local:3689](http://owntone.local:3689),
or, if that won't work, to [http://[your_server_address_here]:3689](http://[your_server_address_here]:3689)
4. Wait for the library scan to complete
5. If you will be using a remote, e.g. Apple Remote: Start the remote, go to
Settings, Add Library
6. Enter the pair code in the web interface (update the page with F5 if it does
not automatically pick up the pairing request)
## Supported clients
OwnTone supports these kinds of clients:
- DAAP clients, like iTunes or Rhythmbox
- Remote clients, like Apple Remote or compatibles for Android/Windows Phone
- AirPlay devices, like AirPort Express, Shairport and various AirPlay speakers
- Chromecast devices
- MPD clients, like mpc (see [mpd-clients](#mpd-clients))
- MP3 network stream clients, like VLC and almost any other music player
- RSP clients, like Roku Soundbridge
Like iTunes, you can control OwnTone with Remote and stream your music to
AirPlay devices.
A single OwnTone instance can handle several clients concurrently, regardless of
the protocol.
By default all clients on 192.168.* (and the ipv6 equivalent) are allowed to
connect without authentication. You can change that in the configuration file.
Here is a list of working and non-working DAAP and Remote clients. The list is
probably obsolete when you read it :-)
| Client | Developer | Type | Platform | Working (vers.) |
| ------------------------ | ----------- | ------ | ------------- | --------------- |
| iTunes | Apple | DAAP | Win | Yes (12.10.1) |
| Apple Music | Apple | DAAP | MacOS | Yes |
| Rhythmbox | Gnome | DAAP | Linux | Yes |
| Diapente | diapente | DAAP | Android | Yes |
| WinAmp DAAPClient | WardFamily | DAAP | WinAmp | Yes |
| Amarok w/DAAP plugin | KDE | DAAP | Linux/Win | Yes (2.8.0) |
| Banshee | | DAAP | Linux/Win/OSX | No (2.6.2) |
| jtunes4 | | DAAP | Java | No |
| Firefly Client | | (DAAP) | Java | No |
| Remote | Apple | Remote | iOS | Yes (4.3) |
| Retune | SquallyDoc | Remote | Android | Yes (3.5.23) |
| TunesRemote+ | Melloware | Remote | Android | Yes (2.5.3) |
| Remote for iTunes | Hyperfine | Remote | Android | Yes |
| Remote for Windows Phone | Komodex | Remote | Windows Phone | Yes (2.2.1.0) |
| TunesRemote SE | | Remote | Java | Yes (r108) |
| rtRemote for Windows | bizmodeller | Remote | Windows | Yes (1.2.0.67) |
## Web interface
You can find the web interface at [http://owntone.local:3689](http://owntone.local:3689)
or alternatively at [http://[your_server_address_here]:3689](http://[your_server_address_here]:3689).
Use the web interface to control playback, trigger manual library rescans, pair
with remotes, select speakers, authenticate with Spotify, etc.
You can find some screenshots and build instructions in [README_PLAYER_WEBINTERFACE.md](https://github.com/owntone/owntone-server/blob/master/README_PLAYER_WEBINTERFACE.md).
## Using Remote
Remote gets a list of output devices from the server; this list includes any
and all devices on the network we know of that advertise AirPlay: AirPort
Express, Apple TV, ... It also includes the local audio output, that is, the
sound card on the server (even if there is no soundcard).
OwnTone remembers your selection and the individual volume for each
output device; selected devices will be automatically re-selected, except if
they return online during playback.
### Pairing
1. Open the [web interface](http://owntone.local:3689)
2. Start Remote, go to Settings, Add Library
3. Enter the pair code in the web interface (update the page with F5 if it does
not automatically pick up the pairing request)
If Remote doesn't connect to OwnTone after you entered the pairing code
something went wrong. Check the log file to see the error message. Here are
some common reasons:
#### You did not enter the correct pairing code
You will see an error in the log about pairing failure with a HTTP response code
that is *not* 0.
Solution: Try again.
#### No response from Remote, possibly a network issue
If you see an error in the log with either:
- a HTTP response code that is 0
- "Empty pairing request callback"
it means that OwnTone could not establish a connection to Remote. This
might be a network issue, your router may not be allowing multicast between the
Remote device and the host OwnTone is running on.
Solution 1: Sometimes it resolves the issue if you force Remote to quit, restart
it and do the pairing proces again. Another trick is to establish some other
connection (eg SSH) from the iPod/iPhone/iPad to the host.
Solution 2: Check your router settings if you can whitelist multicast addresses
under IGMP settings. For Apple Bonjour, setting a multicast address of
224.0.0.251 and a netmask of 255.255.255.255 should work.
Otherwise try using avahi-browse for troubleshooting:
- in a terminal, run `avahi-browse -r -k _touch-remote._tcp`
- start Remote, goto Settings, Add Library
- after a couple seconds at most, you should get something similar to this:
```
+ ath0 IPv4 59eff13ea2f98dbbef6c162f9df71b784a3ef9a3 _touch-remote._tcp local
= ath0 IPv4 59eff13ea2f98dbbef6c162f9df71b784a3ef9a3 _touch-remote._tcp local
hostname = [Foobar.local]
address = [192.168.1.1]
port = [49160]
txt = ["DvTy=iPod touch" "RemN=Remote" "txtvers=1" "RemV=10000" "Pair=FAEA410630AEC05E" "DvNm=Foobar"]
```
Hit Ctrl-C to terminate avahi-browse.
To check for network issues you can try to connect to address and port with
telnet.
## AirPlay devices/speakers
OwnTone will discover the AirPlay devices available on your network. For
devices that are password-protected, the device's AirPlay name and password
must be given in the configuration file. See the sample configuration file
for the syntax.
If your Apple TV requires device verification (always required by Apple TV4 with
tvOS 10.2) then you can do that through Settings > Remotes & Outputs in the web
interface: Select the device and then enter the PIN that the Apple TV displays.
If your speaker is silent when you start playback, and there is no obvious error
message in the log, you can try disabling ipv6 in the config. Some speakers
announce that they support ipv6, but in fact don't (at least not with forked-
daapd).
If the speaker becomes unselected when you start playback, and you in the log
see "ANNOUNCE request failed in session startup: 400 Bad Request", then try
the Apple Home app > Allow Speakers & TV Access > Anyone On the Same Network
(or Everyone).
## Chromecast
OwnTone will discover Chromecast devices available on your network, and you
can then select the device as a speaker. There is no configuration required.
## Local audio through ALSA
In the config file, you can select ALSA for local audio. This is the default.
When using ALSA, the server will try to syncronize playback with AirPlay. You
can adjust the syncronization in the config file.
For most setups the default values in the config file should work. If they
don't, there is help here: [README_ALSA.md](https://github.com/owntone/owntone-server/blob/master/README_ALSA.md)
## Local audio, Bluetooth and more through Pulseaudio
In the config file, you can select Pulseaudio for local audio. In addition to
local audio, Pulseaudio also supports an array of other targets, e.g. Bluetooth
or DLNA. However, Pulseaudio does require some setup, so here is a separate page
with some help on that: [README_PULSE.md](https://github.com/owntone/owntone-server/blob/master/README_PULSE.md)
Note that if you select Pulseaudio the "card" setting in the config file has
no effect. Instead all soundcards detected by Pulseaudio will be listed as
speakers by OwnTone.
You can adjust the latency of Pulseaudio playback in the config file.
## MP3 network streaming (streaming to iOS)
You can listen to audio being played by OwnTone by opening this network
stream address in pretty much any music player:
http://[your hostname/ip address]:3689/stream.mp3
This is currently the only way of listening to your audio on iOS devices, since
Apple does not allow AirPlay receiver apps, and because Apple Home Sharing
cannot be supported by OwnTone. So what you can do instead is install a
music player app like VLC, connect to the stream and control playback with
Remote.
In the speaker selection list, clicking on the icon should start the stream
playing in the background on browsers that support that.
Note that MP3 encoding must be supported by ffmpeg/libav for this to work. If
it is not available you will see a message in the log file. In Debian/Ubuntu you
get MP3 encoding support by installing the package "libavcodec-extra".
## Remote access
It is possible to access a shared library over the internet from a DAAP client
like iTunes. You must have remote access to the host machine.
First log in to the host and forward port 3689 to your local machine. You now
need to broadcast the daap service to iTunes on your local machine. On macOS the
command is:
```
dns-sd -P iTunesServer _daap._tcp local 3689 localhost.local 127.0.0.1 "ffid=12345"
```
The `ffid` key is required but its value does not matter.
Your library will now appear as 'iTunesServer' in iTunes.
You can also access your library remotely using something like Zerotier. See [this
guide](https://github.com/owntone/owntone-server/wiki/Accessing-Owntone-remotely-through-iTunes-Music-with-Zerotier)
for details.
## Supported formats
OwnTone should support pretty much all audio formats. It relies on libav
(or ffmpeg) to extract metadata and decode the files on the fly when the client
doesn't support the format.
Formats are attributed a code, so any new format will need to be explicitely
added. Currently supported:
- MPEG4: mp4a, mp4v
- AAC: alac
- MP3 (and friends): mpeg
- FLAC: flac
- OGG VORBIS: ogg
- Musepack: mpc
- WMA: wma (WMA Pro), wmal (WMA Lossless), wmav (WMA video)
- AIFF: aif
- WAV: wav
- Monkey's audio: ape
## Playlists and internet radio
OwnTone supports M3U and PLS playlists. Just drop your playlist somewhere
in your library with an .m3u or .pls extension and it will pick it up.
From the web interface, and some mpd clients, you can also create and modify
playlists by saving the current queue. Click the "Save" button. Note that this
requires that `allow_modifying_stored_playlists` is enabled in the configuration
file, and that the server has write access to `default_playlist_directory`.
If the playlist contains an http URL it will be added as an internet radio
station, and the URL will be probed for Shoutcast (ICY) metadata. If the radio
station provides artwork, OwnTone will download it during playback and send
it to any remotes or AirPlay devices requesting it.
Instead of downloading M3U's from your radio stations, you can also make an
empty M3U file and insert links in it to the M3U's of your radio stations.
Radio streams can only be played by OwnTone, so that means they will not be
available to play in DAAP clients like iTunes.
The server can import playlists from iTunes Music Library XML files. By default,
metadata from our parsers is preferred over what's in the iTunes DB; use
itunes_overrides = true if you prefer iTunes' metadata.
OwnTone has support for smart playlists. How to create a smart playlist is
documented in
[README_SMARTPL.md](https://github.com/owntone/owntone-server/blob/master/README_SMARTPL.md).
If you're not satisfied with internet radio metadata that OwnTone shows,
then you can read about tweaking it in
[README_RADIO_STREAMS.md](https://github.com/owntone/owntone-server/blob/master/README_RADIO_STREAMS.md).
## Artwork
OwnTone has support for PNG and JPEG artwork which is either:
- embedded in the media files
- placed as separate image files in the library
- made available online by the radio station
For media in your library, OwnTone will try to locate album and artist
artwork (group artwork) by the following procedure:
- if a file {artwork,cover,Folder}.{png,jpg} is found in one of the directories
containing files that are part of the group, it is used as the artwork. The
first file found is used, ordering is not guaranteed;
- failing that, if [directory name].{png,jpg} is found in one of the
directories containing files that are part of the group, it is used as the
artwork. The first file found is used, ordering is not guaranteed;
- failing that, individual files are examined and the first file found
with an embedded artwork is used. Here again, ordering is not guaranteed.
{artwork,cover,Folder} are the default, you can add other base names in the
configuration file. Here you can also enable/disable support for individual
file artwork (instead of using the same artwork for all tracks in an entire
album).
For playlists in your library, say /foo/bar.m3u, then for any http streams in
the list, OwnTone will look for /foo/bar.{jpg,png}.
You can use symlinks for the artwork files.
OwnTone caches artwork in a separate cache file. The default path is
`/var/cache/owntone/cache.db` and can be configured in the configuration
file. The cache.db file can be deleted without losing the library and pairing
informations.
## Library
The library is scanned in bulk mode at startup, but the server will be available
even while this scan is in progress. You can follow the progress of the scan in
the log file or via the web interface. When the scan is complete you will see
the log message: "Bulk library scan completed in X sec".
The very first scan will take longer than subsequent startup scans, since every
file gets analyzed. At the following startups the server looks for changed files
and only analyzis those.
Updates to the library are reflected in real time after the initial scan, so you
do not need to manually start rescans. The directories are monitored for changes
and rescanned on the fly. Note that if you have your library on a network mount
then real time updating may not work. Read below about what to do in that case.
If you change any of the directory settings in the library section of the
configuration file a rescan is required before the new setting will take effect.
You can do this by using "Update library" from the web interface.
Symlinks are supported and dereferenced, but it is best to use them for
directories only.
### Pipes (for e.g. multiroom with Shairport-sync)
Some programs, like for instance Shairport-sync, can be configured to output
audio to a named pipe. If this pipe is placed in the library, OwnTone will
automatically detect that it is there, and when there is audio being written to
it, playback of the audio will be autostarted (and stopped).
Using this feature, OwnTone can act as an AirPlay multiroom "router": You can
have an AirPlay source (e.g. your iPhone) send audio Shairport-sync, which
forwards it to OwnTone through the pipe, which then plays it on whatever
speakers you have selected (through Remote).
The format of the audio being written to the pipe must be PCM16.
You can also start playback of pipes manually. You will find them in remotes
listed under "Unknown artist" and "Unknown album". The track title will be the
name of the pipe.
Shairport-sync can write metadata to a pipe, and OwnTone can read this.
This requires that the metadata pipe has the same filename as the audio pipe
plus a ".metadata" suffix. Say Shairport-sync is configured to write audio to
"/foo/bar/pipe", then the metadata pipe should be "/foo/bar/pipe.metadata".
### Libraries on network mounts
Most network filesharing protocols do not offer notifications when the library
is changed. So that means OwnTone cannot update its database in real time.
Instead you can schedule a cron job to update the database.
The first step in doing this is to add two entries to the 'directories'
configuration item in owntone.conf:
```
directories = { "/some/local/dir", "/your/network/mount/library" }
```
Now you can make a cron job that runs this command:
```
touch /some/local/dir/trigger.init-rescan
```
When OwnTone detects a file with filename ending .init-rescan it will
perform a bulk scan similar to the startup scan.
Alternatively, you can force a metadata scan of the library even if the
files have not changed by creating a filename ending `.meta-rescan`.
### Troubleshooting library issues
If you place a file with the filename ending .full-rescan in your library,
you can trigger a full rescan of your library. This will clear all music and
playlists from OwnTone's database and initiate a fresh bulk scan. Pairing
and speaker information will be kept. Only use this for troubleshooting, it is
not necessary during normal operation.
## Command line
You can choose between:
- a [MPD command line client](#mpd-clients) (easiest) like `mpc`
- curl with OwnTone's JSON API (see [README_JSON_API.md](https://github.com/owntone/owntone-server/blob/master/README_JSON_API.md))
- curl with DAAP/DACP commands (hardest)
Here is an example of how to use curl with DAAP/DACP. Say you have a playlist
with a radio station, and you want to make a script that starts playback of that
station:
1. Run `sqlite3 [your OwnTone db]`. Use `select id,title from files` to get
the id of the radio station, and use `select id,title from playlists` to get
the id of the playlist.
2. Convert the two ids to hex.
3. Put the following lines in the script with the relevant ids inserted (also
observe that you must use a session-id < 100, and that you must login and
logout):
```
curl "http://localhost:3689/login?pairing-guid=0x1&request-session-id=50"
curl "http://localhost:3689/ctrl-int/1/playspec?database-spec='dmap.persistentid:0x1'&container-spec='dmap.persistentid:0x[PLAYLIST-ID]'&container-item-spec='dmap.containeritemid:0x[FILE ID]'&session-id=50"
curl "http://localhost:3689/logout?session-id=50"
```
## Spotify
OwnTone has built-in support for playback of the tracks in your Spotify library.
You must have a Spotify premium account. If you normally log into Spotify with
your Facebook account you must first go to Spotify's web site where you can get
the Spotify username and password that matches your account.
You must also make sure that your browser can reach OwnTone's web interface via
the address [http://owntone.local:3689](http://owntone.local:3689). Try it right
now! That is where Spotify's OAuth page will redirect your browser with the
token that OwnTone needs, so it must work. The address is announced by the
server via mDNS, but if that for some reason doesn't work then configure it via
router or .hosts file. You can remove it again after completing the login.
To authorize OwnTone, open the web interface, locate Settings > Online Services
and then click the Authorize button. You will then be sent to Spotify's
authorization service, which will send you back to the web interface after
you have given the authorization.
Spotify no longer automatically notifies clients about library updates, so you
have to trigger updates manually. You can for instance set up a cron job that
runs `/usr/bin/curl http://localhost:3689/api/update`
To logout and remove Spotify tracks + credentials make a request to
[http://[your_server_address_here]:3689/api/spotify-logout](http://[your_server_address_here]:3689/api/spotify-logout).
Limitations:
You will not be able to do any playlist management through OwnTone - use
a Spotify client for that. You also can only listen to your music by letting
OwnTone do the playback - so that means you can't stream to DAAP clients (e.g.
iTunes) and RSP clients.
### Via librespot/spocon
You can also use OwnTone with one of the various incarnations of
[librespot](https://github.com/librespot-org/librespot). This adds librespot as
a selectable metaspeaker in Spotify's client, and when you start playback,
librespot can be configured to start writing audio to a pipe that you have added
to your library. This will be detected by OwnTone that then starts playback.
You can also have a pipe for metadata and playback events, e.g. volume changes.
The easiest way of accomplishing this may be with [Spocon](https://github.com/spocon/spocon),
since it requires minimal configuration. After installing, create two pipes
(with mkfifo) and set the configuration in the player section:
```
# Audio output device (MIXER, PIPE, STDOUT)
output = "PIPE"
# Output raw (signed) PCM to this file (`player.output` must be PIPE)
pipe = "/srv/music/spotify"
# Output metadata in Shairport Sync format (https://github.com/mikebrady/shairport-sync-metadata-reader)
metadataPipe = "/srv/music/spotify.metadata"
```
### Via libspotify
This method is being deprecated, but is still available if the server was built
with it, libspotify is installed and `use_libspotify` is enabled in the config
file. Please consult [previous README versions](#references) for details on
using libspotify.
## LastFM
You can have OwnTone scrobble the music you listen to. To set up scrobbling
go to the web interface and authorize OwnTone with your LastFM credentials.
OwnTone will not store your LastFM username/password, only the session key.
The session key does not expire.
## MPD clients
You can - to some extent - use clients for MPD to control OwnTone.
By default OwnTone listens on port 6600 for MPD clients. You can change
this in the configuration file.
Currently only a subset of the commands offered by MPD (see [MPD protocol documentation](http://www.musicpd.org/doc/protocol/))
are supported.
Due to some differences between OwnTone and MPD not all commands will act the
same way they would running MPD:
- crossfade, mixrampdb, mixrampdelay and replaygain will have no effect
- single, repeat: unlike MPD, OwnTone does not support setting single and repeat separately
on/off, instead repeat off, repeat all and repeat single are supported. Thus setting single on
will result in repeat single, repeat on results in repeat all.
The following table shows what is working for a selection of MPD clients:
| Client | Type | Status |
| --------------------------------------------- | ------ | --------------- |
| [mpc](http://www.musicpd.org/clients/mpc/) | CLI | Working commands: mpc, add, crop, current, del (ranges are not yet supported), play, next, prev (behaves like cdprev), pause, toggle, cdprev, seek, clear, outputs, enable, disable, playlist, ls, load, volume, repeat, random, single, search, find, list, update (initiates an init-rescan, the path argument is not supported) |
| [ympd](http://www.ympd.org/) | Web | Everything except "add stream" should work |
## Running Multiple Instances
To run multiple instances of owntone on a server, you should copy
`/etc/owntone.conf` to `/etc/owntone-zone.conf` (for each `zone`) and
modify the following to be unique across all instances:
* the three port settings (`general` -> `websocket_port`,
`library` -> `port`, and `mpd` -> `port`)
* the database paths (`general` -> `db_path`, `db_backup_path`, and `db_cache_path`)
* the service name (`library` -> `name`).
* you probably also want to disable local output (set `audio` -> `type =
"disabled"`).
Then run `owntone -c /etc/owntone-zone.conf` to run owntone with the new
zone configuration.
Owntone has a `systemd` template which lets you run this automatically
on systems that use systemd. You can start or enable the service for
a `zone` by `sudo systemctl start owntone@zone` and check that it is
running with `sudo systemctl status owntone@zone`. Use `sudo
systemctl enable ownton@zone` to get the service to start on reboot.
## References
The source for this version of OwnTone can be found here:
[https://github.com/owntone/owntone-server.git](https://github.com/owntone/owntone-server.git)
README's for current and previous versions of OwnTone:
[OwnTone version 28.3](https://github.com/owntone/owntone-server/blob/28.3/README.md)
[OwnTone version 28.2](https://github.com/owntone/owntone-server/blob/28.2/README.md)
[OwnTone version 28.1](https://github.com/owntone/owntone-server/blob/28.1/README.md)
README from when OwnTone was forked-daapd:
[forked-daapd version 27.4](https://github.com/owntone/owntone-server/blob/27.4/README.md)

View File

@ -1,448 +0,0 @@
# OwnTone and ALSA
ALSA is one of the main output configuration options for local audio; when using ALSA you will typically let the system select the soundcard on your machine as the `default` device/sound card - a mixer associated with the ALSA device is used for volume control. However if your machine has multiple sound cards and your system chooses the wrong playback device, you will need to manually select the card and mixer to complete the OwnTone configuration.
## Quick introduction to ALSA devices
ALSA devices can be addressed in a number ways but traditionally we have referred to them using the hardware prefix, card number and optionally device number with something like `hw:0` or `hw:0,1`. In ALSA configuration terms `card X, device Y` is known as `hw:X,Y`.
ALSA has other _prefixes_ for each card and most importantly `plughw`. The `plughw` performs transparent sample format and sample rate conversions and maybe a better choice for many users rather than `hw:` which would fail when provided unsupported audio formats/sample rates.
Alternative ALSA names can be used to refer to physical ALSA devices and can be useful in a number of ways:
* more descriptive rather than being a card number
* consistent for USB numeration - USB ALSA devices may not have the same card number across reboots/reconnects
The ALSA device information required for configuration the server can be deterined using `aplay`, as described in the rest of this document, but OwnTone can also assist; when configured to log at `INFO` level the following information is provided during startup:
```
laudio: Available ALSA playback mixer(s) on hw:0 CARD=Intel (HDA Intel): 'Master' 'Headphone' 'Speaker' 'PCM' 'Mic' 'Beep'
laudio: Available ALSA playback mixer(s) on hw:1 CARD=E30 (E30): 'E30 '
laudio: Available ALSA playback mixer(s) on hw:2 CARD=Seri (Plantronics Blackwire 3210 Seri): 'Sidetone' 'Headset'
```
The `CARD=` string is the alternate ALSA name for the device and can be used in place of the traditional `hw:x` name.
On this machine the server reports that it can see the onboard HDA Intel sound card and two additional sound cards: a Topping E30 DAC and a Plantronics Headset which are both USB devices. We can address the first ALSA device as `hw:0` or `hw:CARD=Intel` or `hw:Intel` or `plughw:Intel`, the second ALSA device as `hw:1` or `hw:E30` and so forth. The latter 2 devices being on USB will mean that `hw:1` may not always refer to `hw:E30` and thus in such a case using the alternate name is useful.
## Configuring the server
OwnTone can support a single ALSA device or multiple ALSA devices.
```
# example audio section for server for a single soundcard
audio {
nickname = "Computer"
type = "alsa"
card = "hw:1" # defaults to 'default'
mixer = "Analogue" # defaults to 'PCM' or 'Master'
mixer_device = "hw:1" # defaults to same as 'card' value
}
```
Multiple devices can be made available to OwnTone using seperate `alsa { .. }` sections.
```
audio {
type = "alsa"
}
alsa "hw:1" {
nickname = "Computer"
mixer = "Analogue"
mixer_device = "hw:1"
}
alsa "hw:2" {
nickname = "Second ALSA device"
}
```
NB: When introducing `alsa { .. }` section(s) the ALSA specific configuration in the `audio { .. }` section will be ignored.
If there is only one sound card, verify if the `default` sound device is correct for playback, we will use the `aplay` utility.
```
# generate some audio if you don't have a wav file to hand
$ sox -n -c 2 -r 44100 -b 16 -C 128 /tmp/sine441.wav synth 30 sin 500-100 fade h 0.2 30 0.2
$ aplay -Ddefault /tmp/sine441.wav
```
If you can hear music played then you are good to use `default` for the server configuration. If you can not hear anything from the `aplay` firstly verify (using `alsamixer`) that the sound card is not muted. If the card is not muted AND there is no sound you can try the options below to determine the card and mixer for configuring the server.
## Automatically Determine ALL relevant the sound card information
As shown above, OwnTone can help, consider the information that logged:
```
laudio: Available ALSA playback mixer(s) on hw:0 CARD=Intel (HDA Intel): 'Master' 'Headphone' 'Speaker' 'PCM' 'Mic' 'Beep'
laudio: Available ALSA playback mixer(s) on hw:1 CARD=E30 (E30): 'E30 '
laudio: Available ALSA playback mixer(s) on hw:2 CARD=Seri (Plantronics Blackwire 3210 Seri): 'Sidetone' 'Headset'
```
Using the information above, we can see 3 soundcards that we could use with OwnTone with the first soundcard having a number of seperate mixer devices (volume control) for headphone and the interal speakers - we'll configure the server to use both these and also the E30 device. The server configuration for theese multiple outputs would be:
```
# using ALSA device alias where possible
alsa "hw:Intel" {
nickname = "Computer - Speaker"
mixer = "Speaker"
}
alsa "hw:Intel" {
nickname = "Computer - Headphones"
mixer = "Headphone"
}
alsa "plughw:E30" {
# this E30 device only support S32_LE so we can use the 'plughw' prefix to
# add transparent conversion support of more common S16/S24_LE formats
nickname = "E30 DAC"
mixer = "E30 "
mixer_device = "hw:E30"
}
```
NB: it is troublesome to use `hw` or `plughw` ALSA addressing when running OwnTone on a machine with `pulseaudio` and if you wish to use refer to ALSA devices directly that you stop `pulseaudio`.
## Manually Determining the sound cards you have / ALSA can see
The example below is how I determined the correct sound card and mixer values for a Raspberry Pi that has an additional DAC card (hat) mounted. Of course using the log output from the server would have given the same results.
Use `aplay -l` to list all the sound cards and their order as known to the system - you can have multiple `card X, device Y` entries; some cards can also have multiple playback devices such as the RPI's onboard soundcard which feeds both headphone (card 0, device 0) and HDMI (card 0, device 1).
```
$ aplay -l
**** List of PLAYBACK Hardware Devices ****
card 0: ALSA [bcm2835 ALSA], device 0: bcm2835 ALSA [bcm2835 ALSA]
Subdevices: 6/7
Subdevice #0: subdevice #0
Subdevice #1: subdevice #1
Subdevice #2: subdevice #2
Subdevice #3: subdevice #3
Subdevice #4: subdevice #4
Subdevice #5: subdevice #5
Subdevice #6: subdevice #6
card 0: ALSA [bcm2835 ALSA], device 1: bcm2835 ALSA [bcm2835 IEC958/HDMI]
Subdevices: 1/1
Subdevice #0: subdevice #0
card 1: IQaudIODAC [IQaudIODAC], device 0: IQaudIO DAC HiFi pcm512x-hifi-0 []
Subdevices: 1/1
Subdevice #0: subdevice #0
```
On this machine we see the second sound card installed, an IQaudIODAC dac hat, and identified as `card 1 device 0`. This is the playback device we want to be used by the server.
`hw:1,0` is the IQaudIODAC that we want to use - we verify audiable playback through that sound card using `aplay -Dhw:1 /tmp/sine441.wav`. If the card has only one device, we can simply refer to the sound card using `hw:X` so in this case where the IQaudIODAC only has one device, we can refer to this card as `hw:1` or `hw:1,0`.
Use `aplay -L` to get more information about the PCM devices defined on the system.
```
$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
sysdefault:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
dmix:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample mixing device
dmix:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct sample snooping device
hw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
bcm2835 ALSA, bcm2835 ALSA
Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
bcm2835 ALSA, bcm2835 IEC958/HDMI
Hardware device with all software conversions
default:CARD=IQaudIODAC
IQaudIODAC,
Default Audio Device
sysdefault:CARD=IQaudIODAC
IQaudIODAC,
Default Audio Device
dmix:CARD=IQaudIODAC,DEV=0
IQaudIODAC,
Direct sample mixing device
dsnoop:CARD=IQaudIODAC,DEV=0
IQaudIODAC,
Direct sample snooping device
hw:CARD=IQaudIODAC,DEV=0
IQaudIODAC,
Direct hardware device without any conversions
plughw:CARD=IQaudIODAC,DEV=0
IQaudIODAC,
Hardware device with all software conversions
```
For the server configuration, we will use:
```
audio {
nickname = "Computer"
type = "alsa"
card="hw:1"
# mixer=TBD
# mixer_device=TBD
}
```
## Mixer name
Once you have the card number (determined from `aplay -l`) we can inspect/confirm the name of the mixer that can be used for playback (it may NOT be `PCM` as expected by the server). In this example, the card `1` is of interest and thus we use `-c 1` with the following command:
```
$ amixer -c 1
Simple mixer control 'DSP Program',0
Capabilities: enum
Items: 'FIR interpolation with de-emphasis' 'Low latency IIR with de-emphasis' 'High attenuation with de-emphasis' 'Fixed process flow' 'Ringing-less low latency FIR'
Item0: 'Ringing-less low latency FIR'
Simple mixer control 'Analogue',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 1
Mono:
Front Left: Playback 1 [100%] [0.00dB]
Front Right: Playback 1 [100%] [0.00dB]
Simple mixer control 'Analogue Playback Boost',0
Capabilities: volume
Playback channels: Front Left - Front Right
Capture channels: Front Left - Front Right
Limits: 0 - 1
Front Left: 0 [0%] [0.00dB]
Front Right: 0 [0%] [0.00dB]
...
```
This card has multiple controls but we want to find a mixer control listed with a `pvolume` (playback) capability - in this case that mixer value required for the server configuration is called `Analogue`.
For the server configuration, we will use:
```
audio {
nickname = "Computer"
type = "alsa"
card="hw:1"
mixer="Analogue"
# mixer_device=TBD
}
```
## Mixer device
This is the name of the underlying physical device used for the mixer - it is typically the same value as the value of `card` in which case a value is not required by the server configuration. An example of when you want to change explicitly configure this is if you need to use a `dmix` device (see below).
## Handling Devices that cannot concurrently play multiple audio streams
Some devices such as various RPI DAC boards (IQaudio DAC, Allo Boss DAC...) cannot have multiple streams openned at the same time/cannot play multiple sound files at the same time. This results in `Device or resource busy` errors. You can confirm if your sound card has this problem by using the example below once have determined the names/cards information as above.
Using our `hw:1` device we try:
```
# generate some audio
$ sox -n -c 2 -r 44100 -b 16 -C 128 /tmp/sine441.wav synth 30 sin 500-100 fade h 0.2 30 0.2
# attempt to play 2 files at the same time
$ aplay -v -Dhw:1 /tmp/sine441.wav &
Playing WAVE '/tmp/sine441.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo
Hardware PCM card 1 'IQaudIODAC' device 0 subdevice 0
Its setup is:
stream : PLAYBACK
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 44100
exact rate : 44100 (44100/1)
msbits : 16
buffer_size : 22052
period_size : 5513
period_time : 125011
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 5513
period_event : 0
start_threshold : 22052
stop_threshold : 22052
silence_threshold: 0
silence_size : 0
boundary : 1445199872
appl_ptr : 0
hw_ptr : 0
$ aplay -v -Dhw:1 /tmp/sine441.wav
aplay: main:788: audio open error: Device or resource busy
```
In this instance this device cannot open multiple streams - OwnTone can handle this situation transparently with some audio being truncated from the end of the current file as the server prepares to play the following track. If this handling is causing you problems you may wish to use [ALSA's `dmix` functionally](https://www.alsa-project.org/main/index.php/Asoundrc#Software_mixing) which provides a software mixing module. We will need to define a `dmix` component and configure the server to use that as it's sound card.
The downside to the `dmix` approach will be the need to fix a samplerate (48000 being the default) for this software mixing module meaning any files that have a mismatched samplerate will be resampled.
## ALSA dmix configuration/setup
A `dmix` device can be defined in `/etc/asound.conf` or `~/.asoundrc` for the same user running OwnTone. We will need to know the underlying physical soundcard to be used: in our examples above, `hw:1,0` / `card 1, device 0` representing our IQaudIODAC as per output of `aplay -l`. We also take the `buffer_size` and `period_size` from the output of playing a sound file via `aplay -v`.
```
# use 'dac' as the name of the device: "aplay -Ddac ...."
pcm.!dac {
type plug
slave.pcm "dmixer"
hint.description "IQAudio DAC s/w dmix enabled device"
}
pcm.dmixer {
type dmix
ipc_key 1024 # need to be uniq value
ipc_key_add_uid false # multiple concurrent different users
ipc_perm 0666 # multi-user sharing permissions
slave {
pcm "hw:1,0" # points at the underlying device - could also simply be hw:1
period_time 0
period_size 4096 # from the output of aplay -v
buffer_size 22052 # from the output of aplay -v
rate 44100 # locked in sample rate for resampling on dmix device
}
hint.description "IQAudio DAC s/w dmix device"
}
ctl.dmixer {
type hw
card 1 # underlying device
device 0
}
```
Running `aplay -L` we will see our newly defined devices `dac` and `dmixer`
```
$ aplay -L
null
Discard all samples (playback) or generate zero samples (capture)
dac
IQAudio DAC s/w dmix enabled device
dmixer
IQAudio DAC s/w dmix device
default:CARD=ALSA
bcm2835 ALSA, bcm2835 ALSA
Default Audio Device
...
```
At this point we are able to rerun the concurrent `aplay` commands (adding `-Ddac` to specify the playback device to use) to verify ALSA configuration.
If there is only one card on the machine you may use `pcm.!default` instead of `pcm.!dac` - there is less configuration to be done later since many ALSA applications will use the device called `default` by default. Furthermore on RPI you can explicitly disable the onboard sound card to leave us with only the IQaudIODAC board enabled (won't affect HDMI sound output) by commenting out `#dtparam=audio=on` in `/boot/config.txt` and rebooting.
### Config with dmix
We will use the newly defined card named `dac` which uses the underlying `hw:1` device as per `/etc/asound.conf` or `~/.asoundrc` configuration. Note that the `mixer_device` is now required and must refer to the real device (see the `slave.pcm` value) and not the named device (ie `dac`) that we created and are using for the `card` configuration value.
For the final server configuration, we will use:
```
audio {
nickname = "Computer"
type = "alsa"
card="dac"
mixer="Analogue"
mixer_device="hw:1"
}
```
## Setting up an Audio Equalizer
There exists an ALSA equalizer plugin. On `debian` (incl Raspberry Pi) systems you can install this plugin by `apt install libasound2-plugin-equal`; this is not currently available on Fedora (FC31) but can be easily built from [source](https://github.com/raedwulf/alsaequal) after installing the dependant `ladspa` package.
Once installed the user must setup a virtual device and use this device in the server configuration.
If you wish to use your `hw:0` device for output:
```
# /etc/asound.conf
ctl.equal {
type equal;
# library /usr/lib64/ladspa/caps.so
}
pcm.equal {
type plug;
slave.pcm {
type equal;
## must be plughw:x,y and not hw:x,y
slave.pcm "plughw:0,0";
# library /usr/lib64/ladspa/caps.so
}
hint.description "equalised device"
}
```
and in `owntone.conf`
```
alsa "equal" {
nickname = "Equalised Output"
# adjust accordingly for mixer with pvolume capability
mixer = "PCM"
mixer_device = "hw:0"
}
```
Using the web UI and on the outputs selection you should see an output called `Equalised Output` which you should select and set the volume.
When starting playback for any audio tracks you should hopefully hear the output. In a terminal, run `alsamixer -Dequal` and you'll see the eqaliser - to test that this is all working, go and drop the upper frequencies and boosting the bass frequencies and give it a second - if this changes the sound profile from your speakers, well done, its done and you can adjust the equalizer as you desire.
Note however, the equalizer appears to require a `plughw` device which means you cannnot use this equalizer with a `dmix` output chain.
# Troubleshooting
* Errors in log `Failed to open configured mixer element` when selecting output device
* Errors in log `Invalid CTL` or `Failed to attach mixer` when playing/adjusting volume
`mixer` value is wrong. Verify name of `mixer` value in server config against the names from all devices capable of playback using `amixer -c <card number>`. Assume the device is card 1:
```
(IFS=$'\n'
CARD=1
for i in $(amixer -c ${CARD} scontrols | awk -F\' '{ print $2 }'); do
amixer -c ${CARD} sget "$i" | grep Capabilities | grep -q pvolume && echo $i
done
)
```
Look at the names output and choose the one that fits. The outputs can be something like:
```
# laptop
Master
Headphone
Speaker
PCM
Mic
Beep
# RPI with no additional DAC, card = 0
PCM
# RPI with additional DAC hat (IQAudioDAC, using a pcm512x chip)
Analogue
Digital
```
* No sound during playback - valid mixer/verified by aplay
Check that the mixer is not muted or volume set to 0. Using the value of `mixer` as per server config and unmute or set volume to max. Assume the device is card 1 and `mixer = Analogue`:
```
amixer -c 1 set Analogue unmute ## some mixers can not be muted resulting in "invalid command"
amixer -c 1 set Analogue 100%
```
An example of a device with volume turned all the way down - notice the `Playback` values are `0`[0%]`:
```
Simple mixer control 'Analogue',0
Capabilities: pvolume
Playback channels: Front Left - Front Right
Limits: Playback 0 - 1
Mono:
Front Left: Playback 0 [0%] [-6.00dB]
Front Right: Playback 0 [0%] [-6.00dB]
```
* Server stops playing after moving to new track in paly queue, Error in log `Could not open playback device`
The log contains these log lines:
```
[2019-06-19 20:52:51] [ LOG] laudio: open '/dev/snd/pcmC0D0p' failed (-16)[2019-06-19 20:52:51] [ LOG] laudio: Could not open playback device: Device or resource busy
[2019-06-19 20:52:51] [ LOG] laudio: Device 'hw' does not support quality (48000/16/2), falling back to default
[2019-06-19 20:52:51] [ LOG] laudio: open '/dev/snd/pcmC0D0p' failed (-16)[2019-06-19 20:52:51] [ LOG] laudio: Could not open playback device: Device or resource busy
[2019-06-19 20:52:51] [ LOG] laudio: ALSA device failed setting fallback quality[2019-06-19 20:52:51] [ LOG] player: The ALSA device 'Computer' FAILED
```
If you have a RPI with a DAC hat with a `pcm512x` chip will affect you. This is because the server wants to open the audio device for the next audio track whilst current track is still playing but the hardware does not allow this - see the comments above regarding determining concurrrent playback.
This error will occur for output hardware that do not support concurrent device open and the server plays 2 files of different bitrate (44.1khz and 48khz) back to back.
If you observe the error, you will need to use the `dmix` configuration as mentioned above.

File diff suppressed because it is too large Load Diff

View File

@ -1,55 +0,0 @@
# OwnTone web interface
Mobile friendly player web interface for [OwnTone](http://owntone.github.io/owntone-server/) build
with [Vue.js](https://vuejs.org), [Bulma](http://bulma.io).
## Screenshots
<img src="screenshots/Screenshot-now-playing.png" width="300" alt="Now playing"> <img src="screenshots/Screenshot-queue.png" width="300" alt="Queue"> <img src="screenshots/Screenshot-artists.png" width="300" alt="Artists"> <img src="screenshots/Screenshot-album.png" width="300" alt="Album">
## Usage
You can find OwnTone's web interface at [http://owntone.local:3689](http://owntone.local:3689)
or alternatively at [http://[your_server_address_here]:3689](http://[your_server_address_here]:3689).
## Build Setup
The source is located in the `web-src` folder.
```
cd web-src
```
The web interface is built with [Vite](https://vitejs.dev/), makes use of Prettier for code formatting
and ESLint for code linting (the project was set up following the guide [ESLint and Prettier with Vite and Vue.js 3](https://vueschool.io/articles/vuejs-tutorials/eslint-and-prettier-with-vite-and-vue-js-3/)
``` bash
# install dependencies
npm install
# Serve with hot reload at localhost:3000
# (assumes that OwnTone server is running on localhost:3689)
npm run serve
# Serve with hot reload at localhost:3000
# (with remote OwnTone server reachable under owntone.local:3689)
VITE_OWNTONE_URL=http://owntone.local:3689 npm run serve
# Build for production with minification (will update web interface in "../htdocs")
npm run build
# Format code
npm run format
# Lint code (and fix errors that can be automatically fixed)
npm run lint
```
After running `npm run serve` the web interface is reachable at [localhost:3000](http://localhost:3000).
By default it expects **owntone** to be running at [localhost:3689](http://localhost:3689) and proxies all
JSON API calls to this location.
If the server is running at a different location you have to set the env variable `VITE_OWNTONE_URL`.

View File

@ -1,149 +0,0 @@
# OwnTone and Pulseaudio
You have the choice of runnning Pulseaudio either in system mode or user mode.
For headless servers, i.e. systems without desktop users, system mode is
recommended.
If there is a desktop user logged in most of the time, a setup with network
access via localhost only for daemons is a more appropriate solution, since the
normal user administration (with, e.g., `pulseaudio -k`) works as advertised.
Also, the user specific configuration for pulseaudio is preserved across
sessions as expected.
- [System mode](#system-mode-with-bluetooth-support)
- [User mode](#user-mode-with-network-access)
## System Mode with Bluetooth support
Credit: [Rob Pope](http://robpope.co.uk/blog/post/setting-up-forked-daapd-with-bluetooth)
This guide was written based on headless Debian Jessie platforms. Most of the
instructions will require that you are root.
### Step 1: Setting up Pulseaudio
If you see a "Connection refused" error when starting the server, then you
will probably need to setup Pulseaudio to run in system mode [1]. This means
that the Pulseaudio daemon will be started during boot and be available to all
users.
How to start Pulseaudio depends on your distribution, but in many cases you will
need to add a pulseaudio.service file to /etc/systemd/system with the following
content:
```
# systemd service file for Pulseaudio running in system mode
[Unit]
Description=Pulseaudio sound server
Before=sound.target
[Service]
ExecStart=/usr/bin/pulseaudio --system --disallow-exit
[Install]
WantedBy=multi-user.target
```
If you want Bluetooth support, you must also configure Pulseaudio to load the
Bluetooth module. First install it (Debian:
`apt install pulseaudio-module-bluetooth`) and then add the following to
/etc/pulse/system.pa:
```
#### Enable Bluetooth
.ifexists module-bluetooth-discover.so
load-module module-bluetooth-discover
.endif
```
Now you need to make sure that Pulseaudio can communicate with the Bluetooth
daemon through D-Bus. On Raspbian this is already enabled, and you can skip this
step. Otherwise do one of the following:
1. Add the pulse user to the bluetooth group: `adduser pulse bluetooth`
2. Edit /etc/dbus-1/system.d/bluetooth.conf and change the policy for
\<policy context="default"\> to "allow"
Phew, almost done with Pulseaudio! Now you should:
1. enable system mode on boot with `systemctl enable pulseaudio`
2. reboot (or at least restart dbus and pulseaudio)
3. check that the Bluetooth module is loaded with `pactl list modules short`
### Step 2: Setting up the server
Add the user the server is running as (typically "owntone") to the
"pulse-access" group:
```
adduser owntone pulse-access
```
Now (re)start the server.
### Step 3: Adding a Bluetooth device
To connect with the device, run `bluetoothctl` and then:
```
power on
agent on
scan on
**Note MAC address of BT Speaker**
pair [MAC address]
**Type Pin if prompted**
trust [MAC address]
connect [MAC address]
```
Now the speaker should appear. You can also verify that Pulseaudio has detected
the speaker with `pactl list sinks short`.
## User Mode with Network Access
Credit: wolfmanx and [this blog](http://billauer.co.il/blog/2014/01/pa-multiple-users/)
### Step 1: Copy system pulseaudio configuration to the users home directory
```
mkdir -p ~/.pulse
cp /etc/pulse/default.pa ~/.pulse/
```
### Step 2: Enable TCP access from localhost only
Edit the file `~/.pulse/default.pa` , adding the following line at the end:
```
load-module module-native-protocol-tcp auth-ip-acl=127.0.0.1
```
### Step 3: Restart the pulseaudio deamon
```
pulseaudio -k
# OR
pulseaudio -D
```
### Step 4: Adjust configuration file
In the `audio` section of `/etc/owntone.conf`, set `server` to `localhost`:
```
server = "localhost"
```
---
[1] Note that Pulseaudio will warn against system mode. However, in this use
case it is actually the solution recommended by the [Pulseaudio folks themselves](https://lists.freedesktop.org/archives/pulseaudio-discuss/2016-August/026823.html).

View File

@ -1,107 +0,0 @@
# OwnTone and Radio Stream tweaking
Radio streams have many different ways in how metadata is sent. Many should
just work as expected, but a few may require some tweaking. If you are not
seeing expected title, track, artist, artwork in clients or web UI, the
following may help.
First, understand what and how the particular stream is sending information.
ffprobe is a command that can be used to interegrate most of the stream
information. `ffprobe <http://stream.url>` should give you some useful output,
look at the Metadata section, below is an example.
```
Metadata:
icy-br : 320
icy-description : DJ-mixed blend of modern and classic rock, electronica, world music, and more. Always 100% commercial-free
icy-genre : Eclectic
icy-name : Radio Paradise (320k aac)
icy-pub : 1
icy-url : https://radioparadise.com
StreamTitle : Depeche Mode - Strangelove
StreamUrl : http://img.radioparadise.com/covers/l/B000002LCI.jpg
```
In the example above, all tags are populated with correct information, no
modifications to the server configuration should be needed. Note that
StreamUrl points to the artwork image file.
Below is another example that will require some tweaks to the server, Notice
`icy-name` is blank and `StreamUrl` doesn't point to an image.
```
Metadata:
icy-br : 127
icy-pub : 0
icy-description : Unspecified description
icy-url :
icy-genre : various
icy-name :
StreamTitle : Pour Some Sugar On Me - Def Leppard
StreamUrl : https://radio.stream.domain/api9/eventdata/49790578
```
In the above, first fix is the blank name, second is the image artwork.
### 1) Set stream name/title via the M3U file
Set the name with an EXTINF tag in the m3u playlist file:
```
#EXTM3U
#EXTINF:-1, - My Radio Stream Name
http://radio.stream.domain/stream.url
```
The format is basically `#EXTINF:<length>, <Artist Name> - <Artist Title>`.
Length is -1 since it's a stream, `<Artist Name>` was left blank since
`StreamTitle` is accurate in the Metadata but `<Artist Title>` was set to
`My Radio Stream Name` since `icy-name` was blank.
### 2) StreamUrl is a JSON file with metadata
If `StreamUrl` does not point directly to an artwork file then the link may be
to a json file that contains an artwork link. If so, you can make the server
download the file automatically and search for an artwork link, and also track
duration.
Try to download the file, e.g. with `curl "https://radio.stream.domain/api9/eventdata/49790578"`.
Let's assume you get something like this:
```
{
"eventId": 49793707,
"eventStart": "2020-05-08 16:23:03",
"eventFinish": "2020-05-08 16:27:21",
"eventDuration": 254,
"eventType": "Song",
"eventSongTitle": "Pour Some Sugar On Me",
"eventSongArtist": "Def Leppard",
"eventImageUrl": "https://radio.stream.domain/artist/1-1/320x320/562.jpg?ver=1465083491",
"eventImageUrlSmall": "https://radio.stream.domain/artist/1-1/160x160/562.jpg?ver=1465083491",
"eventAppleMusicUrl": "https://geo.itunes.apple.com/dk/album/530707298?i=530707313"
}
```
In this case, you would need to tell the server to look for "eventDuration"
and "eventImageUrl" (or just "duration" and "url"). You can do that like this:
```
curl -X PUT "http://localhost:3689/api/settings/misc/streamurl_keywords_length" --data "{\"name\":\"streamurl_keywords_length\",\"value\":\"duration\"}"
curl -X PUT "http://localhost:3689/api/settings/misc/streamurl_keywords_artwork_url" --data "{\"name\":\"streamurl_keywords_artwork_url\",\"value\":\"url\"}
```
If you want multiple search phrases then comma separate, e.g. "duration,length".
### 3) Set metadata with a custom script
If your radio station publishes metadata via another method than the above, e.g.
just on their web site, then you will have to write a script that pulls the
metadata and then pushes it to the server. To update metadata for the
currently playing radio station use something like this JSON API request:
```shell
curl -X PUT "http://localhost:3689/api/queue/items/now_playing?title=Awesome%20title&artwork_url=http%3A%2F%2Fgyfgafguf.dk%2Fimages%2Fpige3.jpg"
```
If your radio station is not returning any artwork links, you can also just make
a static artwork by placing a png/jpg in the same directory as the m3u, and with
the same name, e.g. `My Radio Stream.jpg` for `My Radio Stream.m3u`.

View File

@ -1,211 +0,0 @@
# OwnTone smart playlists
To add a smart playlist to the server, create a new text file with a filename ending with .smartpl;
the filename doesn't matter, only the .smartpl ending does. The file must be placed somewhere in your
library folder.
## Syntax
The contents of a smart playlist must follow the syntax:
```
"Playlist Name" { expression }
```
There is exactly one smart playlist allowed for a .smartpl file.
An expression consists of:
```
field-name operator operand
```
Where valid field-names (with their types) are:
* `artist` (string)
* `album_artist` (string)
* `album` (string)
* `title` (string)
* `genre` (string)
* `composer` (string)
* `comment` (string)
* `path` (string)
* `type` (string)
* `grouping` (string)
* `data_kind` (enumeration)
* `media_kind` (enumeration)
* `play_count` (integer)
* `skip_count` (integer)
* `rating` (integer)
* `year` (integer)
* `compilation` (integer)
* `track` (integer)
* `disc` (integer)
* `time_added` (date)
* `time_modified` (date)
* `time_played` (date)
* `time_skipped` (date)
* `random` (special)
Valid operators include:
* `is`, `includes`, `starts with`, `ends with` (string)
* `>`, `<`, `<=`, `>=`, `=` (int)
* `after`, `before` (date)
* `is` (enumeration)
The `is` operator must exactly match the field value, while the `includes` operator matches a substring.
The `starts with` operator matches, if the value starts with the given prefix,
and `ends with` matches the opposite. All these matches are case-insensitive.
Valid operands include:
* "string value" (string)
* integer (int)
Valid operands for the enumeration `data_kind` are:
* `file`
* `url`
* `spotify`
* `pipe`
Valid operands for the enumeration `media_kind` are:
* `music`
* `movie`
* `podcast`
* `audiobook`
* `tvshow`
Multiple expressions can be anded or ored together, using the keywords `OR` and `AND`. The unary not operator is also supported using the keyword `NOT`.
It is possible to define the sort order and limit the number of items by adding an order clause and/or a limit clause after the last expression:
```
"Playlist Name" { expression ORDER BY field-name sort-direction LIMIT limit }
```
"sort-direction" is either `ASC` (ascending) or `DESC` (descending). "limit" is the maximum number of items.
There is additionally a special `random` _field-name_ that can be used in conjunction with `limit` to select a random number of items based on current expression.
## Examples
```
"techno" {
genre includes "techno"
and artist includes "zombie"
}
```
This would match songs by "Rob Zombie" or "White Zombie", as well as those with a genre of "Techno-Industrial" or
"Trance/Techno", for example.
```
"techno 2015" {
genre includes "techno"
and artist includes "zombie"
and not genre includes "industrial"
}
```
This would exclude e. g. songs with the genre "Techno-Industrial".
```
"Local music" {
data_kind is file
and media_kind is music
}
```
This would match all songs added as files to the library that are not placed under the folders for podcasts, audiobooks.
```
"Unplayed podcasts and audiobooks" {
play_count = 0
and (media_kind is podcast or media_kind is audiobook)
}
```
This would match any podcast and audiobook file that was never played.
```
"Recently added music" {
media_kind is music
order by time_added desc
limit 10
}
```
This would match the last 10 music files added to the library.
```
"Random 10 Rated Pop songs" {
rating > 0 and
genre is "Pop" and
media_kind is music
order by random desc
limit 10
}
```
This generates a random set of, maximum of 10, rated Pop music tracks every time the playlist is queried.
## Date operand syntax
One example of a valid date is a date in yyyy-mm-dd format:
```
"Files added after January 1, 2004" {
time_added after 2004-01-01
}
```
There are also some special date keywords:
* `today`, `yesterday`, `this week`, `last week`, `last month`, `last year`
These dates refer to the _start_ of that period; `today` means 00:00hrs of today, `this week` means current Monday 00:00hrs, `last week` means the previous Monday 00:00hrs, `last month` is the first day of the previous month at 00:00hrs etc.
A valid date can also be made by applying an interval to a date. Intervals can be defined as `days`, `weeks`, `months`, `years`.
As an example, a valid date might be:
```3 weeks before today``` or ```3 weeks ago```
Examples:
```
"Recently Added" {
time_added after 2 weeks ago
}
```
This matches all songs added in the last 2 weeks.
```
"Recently played audiobooks" {
time_played after last week
and media_kind is audiobook
}
```
This matches all audiobooks played since the start of the last Monday 00:00AM.
All dates, except for `YYYY-DD-HH`, are relative to the day of when the server evaluates the smartpl query; `time_added after today` run on a Monday would match against items added since Monday 00:00hrs and evaluating the same smartpl on Friday would only match against added on Friday 00:00hrs.
Note that `time_added after 4 weeks ago` and `time_added after last month` are subtly different; the former is exactly 4 weeks ago (from today) whereas the latter is the first day of the previous month.
## Differences to mt-daapd smart playlists
The syntax is really close to the mt-daapd smart playlist syntax (see
http://sourceforge.net/p/mt-daapd/code/HEAD/tree/tags/release-0.2.4.2/contrib/mt-daapd.playlist).
Even this documentation is based on the file linked above.
Some differences are:
* only one smart playlist per file
* the not operator must be placed before an expression and not before the operator
* "||", "&&", "!" are not supported (use "or", "and", "not")
* comments are not supported

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB