ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Wed Jul 31, 2013 7:33 am

DesignerBoy wrote:I have speakers set up to the pi and also another wireless airplay speaker. When using the remote app to play to both there is a slight delay to one of the speakers. Is this normal? If I set up another pi as an airplay would that also have a delay?

And finally, the sound quality from the pi is a bit hissy/noisy especially at low volumes. Is this also normal?

Thanks. You have done a fantastic job getting this to work.
Thanks, you're welcome.

I think AirPlay speakers have a small buffer, so it is normal that sound is delayed. forked-daapd does not support syncronisation between speakers, so if you want output through multiple speakers that are within hearing range of each other, you are out of luck.

Since the Pi only has wired network I keep it next to my router in the wardrobe. I output sound through an Airport Express connected to my stereo. So I've only tried the Pi's own sound card once or twice, and I don't know much about the sound quality of that.

ryaninja
Posts: 37
Joined: Wed Jul 24, 2013 4:22 pm

Re: Improved forked-daapd (iTunes server)

Tue Aug 06, 2013 4:39 pm

so having a search around the forum, i find myself here !
im running raspbmc on my pi and can airplay music stored on my iphone to it.
im using remote on my iphone to choose music from my windows xp itunes libary and play on my windows pc.
Is this the solution i need to play said music through my rpi using my iphone as the remote?

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Wed Aug 07, 2013 7:18 am

ryaninja wrote:Is this the solution i need to play said music through my rpi using my iphone as the remote?
If you mean play music from your pi using your iPhone as remote then yes, it might be. But if you want to use xbmc as AirPlay speaker you might run into the same problem as jpbaril: "I tried something. As I use Raspbmc I have XBMC on my Pi and XBMC can act out of the box like an Airplay speaker. I tried it (Forked-Daapd on Pi sending music to itself through Airplay) but it crashed XBMC."

jpbaril
Posts: 13
Joined: Fri Mar 29, 2013 7:20 pm

Re: Improved forked-daapd (iTunes server)

Sun Aug 11, 2013 3:34 am

Hi and thanks for your help.

I have finally been able to "pair" (add) my forked-daapd server to the list of available servers in Remote for iTunes.
But when I select it, it is not able to connect and says something like (I translate): "Raspberry-pi is stopped or unreachable. New try in a moment". So it tries to connect again and again with same result.

In Raspberry-pi logs I have : "remote: Remote 'Remote for iTunes' not known from mDNS, ignoring".
But if I scan avahi services advertised on network, Remote for iTunes is there.
ejurgensen wrote: I seem to have found a way to pair Hyperfines Remote for iTunes with forked-daapd. In my case, the problem seems to have been that the Raspberry was unable to initiate a network connection to my Android phone. So what I did was first establish a connection from the phone to the Raspberry. This can be any connection, it doesn't need to be Remote-related. I opened a connection from a file browser app to the Samba drive on the Raspberry, but I think any connection will do. Probably just entering the IP address of the Pi in a browser on the phone will do the trick. After this, I opened Remote for iTunes and completed the normal pairing procedure.

Mind you, your log file says HTTP response code 404, which means you entered the wrong PIN code. My log file said response code 0, which apparently means no connection. So we might not be having the same problem.

Also after pairing succeeded, I noticed that Remote for iTunes shows album titles when you browse for artists. So that is pretty useless. It is also really strange, since the artist browse query is pretty straightforward in DAAP.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Aug 11, 2013 2:43 pm

jpbaril wrote:In Raspberry-pi logs I have : "remote: Remote 'Remote for iTunes' not known from mDNS, ignoring".
Well, I think this just means that forked-daapd has found the .remote file. If you succeeded pairing I suggest you delete the .remote file. Then set logging to debug (which you probably already did), and then open Remote for iTunes and try to connect. Then look for lines with "remote" or with both "daap" and "request" in the log, and post them here. There might be nothing at all, and that means Remote for iTunes simply cannot reach/find forked-daapd. However, why that would be I don't know.

After I paired Remote for iTunes with my forked-daapd they have connected without issues, however the artist listing in Remote for iTunes is not good. It also contains album names.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Tue Aug 13, 2013 2:07 pm

Hi ejurgensen,

thought i'd move this part of the discussion to the correct thread!

do you have any idea how the iTunes Library XML support works?

for one i know any paths it will find from a Windows-based library will definitely be wrong!
eg file://I:/iTunes/iTunes Media/Music/Artist/song.mp3

thanks
j

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Tue Aug 13, 2013 2:28 pm

jmp909 wrote:do you have any idea how the iTunes Library XML support works?
I have no idea!

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Wed Aug 14, 2013 1:06 am

i was looking at this.. it looks like it's trying to get the path to the file in the library, using the value from the XML file as a basis
https://github.com/jasonmc/forked-daapd ... r_itunes.c

Code: Select all

find_track_file(char *location, char *base) ..... plen = strlen("file://localhost/");  
[/size]etc

for me that'll be at eg:

Code: Select all

<key>Location</key><string>file://localhost/I:/iTunes/iTunes%20Media/Music/Aphex%20Twin/Selected%20Ambient%20Works%2085-92/03%20Pulsewidth.mp3</string>
[/size]

I don't understand the code entirely, but i assume it's somehow trying to map my windows path of

Code: Select all

file://localhost/I:/iTunes/iTunes%20Media/Music
to my linux library path of

Code: Select all

/media/IOMEGA_2TB/iTunes/iTunes Media/Music
i can see it's skipping past the drive letter and :

Code: Select all

  /* Windows pathspec, from iTunes Win32 */
  if (location[plen + 1] == ':')
    plen += 2;
  else
    plen -= 1;
[/size]after that I get a bit lost as to what it's doing!

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Thu Aug 15, 2013 9:17 pm

So I've made a new release (10). It has the following:
- support for internet radio playlists (http links in m3u files)
- bug fix for AirFoil Speakers
Thank you to jmp909 for bringing these issues to my attention.

@jmp909: In theory, with this version you can do like you wanted in your post. You would need to do like this:
1. Install a light weight webserver.
2. With shairport (AirPi) stream to a pipe. With lame transcode this pipe to an mp3 pipe (let's call it airpi.mp3), which you put in a directory so it gets served as http://localhost/airpi.mp3.
3. Begin listening to music on your iOS device using AirPi.
4. Check with avprobe http://localhost/airpi.mp3 that libav can resolve the encoding. It should tell you it's mp3.
5. Make a m3u playlist in your library containing http://localhost/airpi.mp3.
6. Select your playlist in Remote and play the music on the speakers you like.
It's important to do it in this order, and that streaming is active when you add the playlist, because forked-daapd will ask libav to resolve the encoding, and if that fails it won't be added to your playlist. I haven't tried if this actually works. My AirPi is very unstable, and libav had trouble finding the encoding.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Fri Aug 16, 2013 9:15 am

@jmp909: Sorry, my first recipe for streaming from AirPi to forked-daapd was wrong. It wouldn't work because forked-daapd will not scan pipes, so it would never be included in the library. So now I changed the recipe, adding an intermediate webserver serving the pipe. I'm not sure it will actually work, perhaps there are some tricks about streaming with AirPi and webservers I don't know of.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sat Aug 17, 2013 10:28 pm

I've made a new release (11), this one fixes a problem where forked-daapd would crash when you stopped your music.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Thu Aug 22, 2013 8:45 am

Yet another version (12), this time I made some improvements to the .m3u and iTunes XML playlist scanner. It should now be better at locating the songs from the playlist in the library, even when the directory paths in the playlist are wrong (which they usually will be, because the playlist is created somewhere else).

@jmp909: You were right about what the iTunes scanner was doing, it was trying to map your Windows path with your Linux path. First it tried matching the entire path excluding the "file://localhost/D:"-part. Then it tried looking just for the file name in any subdir below the playlist file's own location, and finally it tried looking for just the file name. My version works by first looking for just the file name in the library, and only if the result is ambiguous will it begin taking into account the directory path. Another thing: I made another attempt at making a stable mp3 stream with Shairport, but it didn't really work. So until that's resolved I guess forked-daapd can't help with your multispeaker issue.

sprevrha
Posts: 2
Joined: Sat Apr 13, 2013 2:18 pm

Re: Improved forked-daapd (iTunes server)

Sun Aug 25, 2013 12:08 pm

Great work, the new version (11+) works fine on my Pi. I can play my library (5000+ songs) on my PC's iTunes no problem. I can pick up the library on my Hyperfine Remote for iTunes Android app and choose songs and play them. The Remote is very slow to display the list of artists and albums though. It sees my Philips Fidelio wireless speaker, but when I select it, the checkbox unchecks itself after a second. No entry in the forked-daapd.log. Is it a problem with the software, the speaker or the remote app?

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sun Aug 25, 2013 4:24 pm

There is a problem with Hyperfines Remote for iTunes, where it makes a query asking for an artist listing, but forked-daapd understands it as asking for a complete album listing. Since Remote at the same time asks for a complete album listing, the effect is that the complete listing gets sent twice, giving you slower response times. I'll try to fix it in forked-daapd at some point, but it's not an easy hack. You might want to give TunesRemote+ a try, it doesn't have this problem. If you're lucky it might also solve the problem with your speakers. The fact that you don't see anything in your logs (even with loglevel=debug?) when it fails could be an indication that the problem is with Hyperfine Remote. Let me know if it works out better with TunesRemote+.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sat Aug 31, 2013 4:46 pm

I made a new version (forked-daapd_0.19.13.git04ae27f) which has better compability with Hyperfine Remote for Android. Now it can reply with proper artist lists, and it understands Hyperfine's way of playing/pausing music and selecting speakers. It also fixes a general issue regarding speaker selection.

If you want to give it a try, and plan on using Hyperfine Remote, then notice that pairing Hyperfine Remote with forked-daapd might require a little trick described here.

jmp909
Posts: 56
Joined: Sat Jul 21, 2012 12:32 am

Re: Improved forked-daapd (iTunes server)

Tue Sep 24, 2013 12:35 pm

thanks ejurgensen, my notifications were off on this thread.. i'll check if this is working better later on.

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Wed Sep 25, 2013 9:34 pm

I've uploaded another release (forked-daapd_0.19.14.git9704a1e) with some more improvements:
- Internet radio metadata support (Shoutcast/icy metadata)
- Fixed a bug when restarting an item in a playlist with just one item
- Updated some deprecated ffmpeg/libav stuff

Internet radio metadata will only be collected by forked-daapd when an m3u is added or updated, so if you've been using a previous version of forked-daapd and want metadata, you will need to trigger a rescan (you can use the 'touch' command for that).

croque
Posts: 7
Joined: Thu Sep 26, 2013 6:52 am

Re: Improved forked-daapd (iTunes server)

Thu Sep 26, 2013 1:18 pm

Hi!
I like the forked-daapd and appreciate the good work being done. But now I have encountered some trouble with my headless setup.

Since I really want a headless setup without storage I need to mount the music archive from network. forked-daapd is based on libevent 1.4 and nfs-common on 2.0. The samba client doesn't seem to bother about events at all.

There are no problems with accessing music over nfs shares but forked-daapd gets no events when new files is added like it is when new files are added to local storage. This means that the server need a restart every single time new music is added.

Is it possible to solve this problem? Build nfs-common from source (kernel?) with libevent 1.4? I have no clue how to do that…

/ Markus

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Thu Sep 26, 2013 9:23 pm

When I got my Raspberry I wanted to do the same. I already had my music on a NAS, and just wanted to mount it as a NFS or Samba share. However, like you have found out, this means that forked-daapd will not detect library changes.

I researched the issue, and actually it is not libevent that does the detection. It is a mechanism called inotify which is part of the Linux kernel and file system modules. So basically it is the kernel which detects the change. As far I could tell, inotify is not supported across network shares (not even nfs), so it seemed impossible to solve the problem.

I ended up buying a 64GB flash disk and attaching it to my Raspberry, so now my Raspberry has become NAS for my music. The flash disk was cheap and it uses little power, so I'm quite happy with it.

croque
Posts: 7
Joined: Thu Sep 26, 2013 6:52 am

Re: Improved forked-daapd (iTunes server)

Fri Sep 27, 2013 7:35 am

I've also done some research about inotify. According to the developers inotify will never support NFS. They refers to gamin and FAM. gamin makes use of inotify for local filesystems and polls NFS periodically.

That forces med to rethink the media architecture since my archive goes far beyond the size of flash drives. =)

I sure can run forked-daapd on my NAS. But that doesn't brings me the feature of using the Remote app with remote playback. No problem with the laptop's using ITunes, they could use either AirPlay for remote playback or local playback if wanted. I've searched for a similar app for iPad/iPhone but found no option. Is that really so? No iPad/iPhone app that browses daap and plays the streams either locally or remote via AirPlay?

As an alternative LMS seems Ok. Laptop clients can browse the library from web access or by SqueezePlay desktop client and choose AirPlay or similar (SqueezeLite) players as playback device. iPad/iPhone can use iPeng or other compatible apps.

But I really like the simplicity of ITunes, ITunes Server and Airplay...

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Fri Sep 27, 2013 8:34 am

croque wrote:I sure can run forked-daapd on my NAS. But that doesn't brings me the feature of using the Remote app with remote playback.
I'm not sure I understand this part - if you can run forked-daapd directly on your NAS you should get inotify detection and support for Remote App and remote playback?
croque wrote:No problem with the laptop's using ITunes, they could use either AirPlay for remote playback or local playback if wanted. I've searched for a similar app for iPad/iPhone but found no option. Is that really so? No iPad/iPhone app that browses daap and plays the streams either locally or remote via AirPlay?
Do you mean a straight daap client? I've only tried some for Android, but Google says Apple Store has this one: https://itunes.apple.com/us/app/simple- ... 05270?mt=8

Another way of getting local playback on iPad/iPhone is using Remote + AirFoil Speakers (but again, I have no experience with that combination).
Last edited by ejurgensen on Fri Sep 27, 2013 6:25 pm, edited 1 time in total.

croque
Posts: 7
Joined: Thu Sep 26, 2013 6:52 am

Re: Improved forked-daapd (iTunes server)

Fri Sep 27, 2013 6:15 pm

My bad.

It works exact the way I like it running forked-daapd on the NAS and using iPad/iPhone with Remote app and laptop with ITunes as controls. The RPi now only works as AirPlay-bridge to my stereo system.

The Remote app where a little bit more capable than I thought when I tested it out. =)

It is some fine work made here. Thanks. =)

MrRaf1k1
Posts: 4
Joined: Sat Sep 28, 2013 6:41 am

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 7:00 am

Thanks ejurgensen for your great work.

I really interested in forwarding a airplay stream via: shairport --> pipe --> mp3 --> forked-dappd --> AE.

On this site http://serioustinker.blogspot.de/2013/0 ... erver.html Jonas describes howto create a stable mp3-file with shairport and vlc. Do you think this result can be used as source for forked-dappd?

ejurgensen
Posts: 585
Joined: Thu Jul 04, 2013 8:11 pm
Location: Denmark

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 10:43 am

Yes, I think that would be a good way of doing it. If you can make it work I think jmp909 would also be very interested, he was looking for something similar.

It should output a regular http mp3 stream at the address http://localhost:8080/sound.mp3 which forked-daapd should be able to play. To add it to your library create a m3u file with this address in your music directory. It is probably best to have music streaming while you do this, so the encoding gets detected.

MrRaf1k1
Posts: 4
Joined: Sat Sep 28, 2013 6:41 am

Re: Improved forked-daapd (iTunes server)

Sat Sep 28, 2013 11:33 am

ejurgensen wrote:Yes, I think that would be a good way of doing it. If you can make it work I think jmp909 would also be very interested, he was looking for something similar.

It should output a regular http mp3 stream at the address http://localhost:8080/sound.mp3 which forked-daapd should be able to play. To add it to your library create a m3u file with this address in your music directory. It is probably best to have music streaming while you do this, so the encoding gets detected.
yes, this is working.

I run for testing with following commands:
1. starting a new shairport instance with pipe
$ sudo shairport.pl -a AirPi2 --pipe=/tmp/airpi -o 5012 --play_prog="echo play | nc localhost 7070" &

2. starting a new vlc instance with http-output
$ /usr/bin/vlc -v -I rc --rc-host localhost:7070 --demux=rawaud --rawaud-channels 2 --rawaud-samplerate 44100 /tmp/airpi --sout '#gather:transcode{acodec=mpga,ab=128,channels=2,samplerate=44100}:http{mux=dummy,dst=:8080/sound.mp3}' --sout-keep --repeat &

Now, if you choose as Airplay sink AirPi2 you can hear the stream on http://localhost:8080/sound.mp3 via MediaPlayer. Stable mp3 decoding seems to work.

3. creating a playlist for forked-daapd
I created a file named sound.m3u with following content:
http://localhost:8080/sound.mp3
and placed this file in iTunes library directory.

forked-daapd is indexing the m3u-file and I can choose sound.mp3 in the iPhone remote-app and choose whether I want to play this locally (soundcard) or via Airplay to any receiver or all of it (multiple devices possible).

4. automatically start forked-daapd playback
Is there a way to start automatically the player with defined destinations (text-based without remote-app)?

5. finishing
If everything is clear the last step should be to start all programs on boot (with rc.d script).

Return to “Raspbian”