Moode Audio Player for Raspberry Pi

Igbee:


I feel your pain. My grandkids always manage to find reasons for me to run my phone in hotspot mode when we're out and about. I can almost hear the juice being sucked out of the battery, and I can definitely feel the thermal "hot spot" on the phone casing!

WiFi Direct can be a bit a swamp. First off, it requires the right hardware---the chipset needs to support P2P. Apparently, the RPi3 chipset does; some USB WiFi adapter chipsets do, some don't. Then there's the Linux driver conundrum. Then there's known problems with some versions of packages like wpa_supplicant. Use your favorite search engine to see the successes and failures with RPis reported by others. On the whole it appears doable given sufficient motivation.

A question - do you intend for more than one phone to communicate with the RPi? Supposedly WiFi Direct supports one-to-many connections, but my search engine turns up reports of both successes and failures with real-world products. I've used WiFi Direct only with certain Android phones known to interoperate and only in one-to-one mode.

Zootalaws proposal cuts across all of this. You pay your money and you get a working solution. Done and done! As a bonus, the mobile hotspot can be (re)used for other purposes as well.

Regards,
Kent

Regarding Wifi Direct - my dongle apparently supports it but it seems a bit complicated to set up. I think at least 1 person has done but it does seem to be a swamp as you said. https://www.raspberrypi.org/forums/viewtopic.php?f=63&t=31596
 
Thanks for the additional suggestions for portable connections.

I'm just getting up and running on my android phone. I am connected to the "Moode" AP and I thought that I could put http://127.24.1.1 in the browser instead of Moode.local - but it does not connect. Is there a different IP address I need to find when on Android?

Hi,

172.24.1.1

-Tim
 
Hi,

172.24.1.1

-Tim

Thanks Tim - I think my typo confused things and I had been trying the correct address.

I used a computer connection to set up the Moode wireless to connect to my android hotspot as some suggested. I'm using BubbleUpnp to stream files from my phone to the Moode Upnp Renderer. Really really happy with this setup so far as I did not have to load any files on a usb stick.
 
Hi Rafa,

Generally, integrating a renderer requires the following:

1. A recipe for install/compile/configure all component pieces
2. A column in cfg_engine sql table for On/Off state
3. A dedicated configuration sql table and config screen if there are lot of user settings.
4. UI elements on snd-config.html and snd-config.php for on/off/name, a configure link if #3 is needed
5. Function in playerlib.php for start/stop/restart/configure the renderer
6. A startup block in worker.php for automatically starting the renderer if prior state was 'on'
7. Job case(s) in worker.php that processes submitJob() call from snd-config.php
8. The job case typically calls function mentioned in #5 but it also may do other things
9. If the renderer has hooks for pre and post processing then two bash scripts, one for saving current Moode volume, stopping play, the other for restoring Moode volume
10. A systemd unit if required for example /lib/systemd/system/squeezelite-armv7l.service and mpd.service. If the settings are configurable then code or job added to perform updates to the file usually via sed, refresh systemd, etc.

Airplay (shairport-sync) is an example of a renderer with hooks for pre/post processing, configurable software/hardware volume, binary launched as command line string. A single shairport-sync binary runs on both armv7 and armv6 platforms

Squeezelite is an example of a renderer with dedicated config page, binary launched from via systemd unit. Separate Sqeezelite binaries for armv6 and armv7 platforms.

-Tim

Ok,

I'll attempt to tackle this with Tims help! Lets get to step 1 :) :

By recipe you mean broad instructions or an actual recipe for some package installer / handler like Docker or Chef?

Regarding this, there are a couple of choices as to how to run this.

All create a spotify-connect server that can be controlled with the tablet, phone, computer, etc. that you use to connect to spotify.

Now, each options presents its advantages and downsides:

A. Run the binary / script with parameters (that would be input into the sql table) that mounts automatically a web server on port:4000 that renders a basic "play transports" page with play, pause, next, and track basic info. This, while of little use, has the distinct advantage that it exposes RESTfull routes to the 4000 port to fetch metadata, and even exposes the transport routes: play, pause, next. So this could be 'mapped' to the Moode transport controls as well as the info pane with track metadata and even album art.

B. Run the same script but from source (python script), which requires some dev libraries to be installed, but nothing really extreme, most probably are already needed by some or other moode services. All the advantages of the above option. Not sure if this is actually better or worse, need some feedback on this.

C. Run a 'sub script' from source (requires same libraries as above), but this only creates the connect server, not the web server. It is lighter, of course, and prevents another server listening to external requests inside the RPi, but this would require a different integration to fetch metadata and could be more 'coupled' into Moode. That info would probably require creating a custom python script to be used within Moode Client.

Any thoughts on which way to pursue?

Thanks again,
Rafa.
 
Ok,

I'll attempt to tackle this with Tims help! Lets get to step 1 :) :

By recipe you mean broad instructions or an actual recipe for some package installer / handler like Docker or Chef?

Regarding this, there are a couple of choices as to how to run this.

All create a spotify-connect server that can be controlled with the tablet, phone, computer, etc. that you use to connect to spotify.

Now, each options presents its advantages and downsides:

A. Run the binary / script with parameters (that would be input into the sql table) that mounts automatically a web server on port:4000 that renders a basic "play transports" page with play, pause, next, and track basic info. This, while of little use, has the distinct advantage that it exposes RESTfull routes to the 4000 port to fetch metadata, and even exposes the transport routes: play, pause, next. So this could be 'mapped' to the Moode transport controls as well as the info pane with track metadata and even album art.

B. Run the same script but from source (python script), which requires some dev libraries to be installed, but nothing really extreme, most probably are already needed by some or other moode services. All the advantages of the above option. Not sure if this is actually better or worse, need some feedback on this.

C. Run a 'sub script' from source (requires same libraries as above), but this only creates the connect server, not the web server. It is lighter, of course, and prevents another server listening to external requests inside the RPi, but this would require a different integration to fetch metadata and could be more 'coupled' into Moode. That info would probably require creating a custom python script to be used within Moode Client.

Any thoughts on which way to pursue?

Thanks again,
Rafa.

Hi Rafa,

By recipe I mean a list of steps 1, 2, 3... that can be carried out to install and configure the component(s). Something like the shairport-sync example below.

-Tim

1) Install libs
sudo apt-get update
sudo apt-get install autoconf libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev
sudo apt-get install avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev

2) Get sources
sudo git clone https://github.com/mikebrady/shairport-sync.git

3) Prep for compile
cd shairport-sync
sudo autoreconf -i -f

4) Compile
sudo ./configure --with-alsa --with-avahi --with-ssl=openssl --with-soxr --with-metadata --with-stdout --with-systemd
sudo make

5) Install
sudo killall shairport-sync
sudo make install
sudo systemctl disable shairport-sync

6) Cleanup
cd ~
sudo rm -rf ./shairport-sync
shairport-sync -V
 
Thanks - I'm trying to keep this really simple because it will be battery powered. So if I find out anything else I will post here. I know I could do the AP on my phone but the battery is terrible as it is but I'll definitely try this out.

I know Android has a feature called "wifi direct" but I think the moode rpi would have to be configured differently.

My wifi hotspot is battery powered, and I use a 20,000mAh battery bank for the fone
 
Hope someone can help with a wierd problem. I'm running 3.1 2016-12-05 and when streaming off internet radio, the stream will nearly always stop exactly at the 30 minute mark. MPD etc is still up and the stream can be recovered by Playback/stop/start.

I've reEtched the img fron stratch (twice) and have confirmed its not my infrastructure at fault (Another Pi on Volumio has been steaming the same station for > 1day). Ideas /
 
Hello Guys,
Sorry for my English.
I'm tried to connect Official Pi 7 Touchscreen to Moodeaudio 3.1 on my Raspbery 3. I was found the guide from rataks.com and done it step by step. But finally when I boot moodeaudio, at the end of bootscreen on touchscreen, the line "moode login" appears and booting stoped. At this time I can play music and manage it from my smartphone or other devices. What is wrong? The Linux is not my friendly system.
 
Hello Guys,
Sorry for my English.
I'm tried to connect Official Pi 7 Touchscreen to Moodeaudio 3.1 on my Raspbery 3. I was found the guide from rataks.com and done it step by step. But finally when I boot moodeaudio, at the end of bootscreen on touchscreen, the line "moode login" appears and booting stoped. At this time I can play music and manage it from my smartphone or other devices. What is wrong? The Linux is not my friendly system.

Nothing is wrong. Manage/configure Moode via your browsers. You should not have to login to Moode via the command line.

Enjoy
 
For examle like this image:
 

Attachments

  • IMG_1071.jpg
    IMG_1071.jpg
    144.6 KB · Views: 286
Hi Rafa,

By recipe I mean a list of steps 1, 2, 3... that can be carried out to install and configure the component(s). Something like the shairport-sync example below.

-Tim

1) Install libs
sudo apt-get update
sudo apt-get install autoconf libtool libdaemon-dev libasound2-dev libpopt-dev libconfig-dev
sudo apt-get install avahi-daemon libavahi-client-dev libssl-dev libsoxr-dev

2) Get sources
sudo git clone https://github.com/mikebrady/shairport-sync.git

3) Prep for compile
cd shairport-sync
sudo autoreconf -i -f

4) Compile
sudo ./configure --with-alsa --with-avahi --with-ssl=openssl --with-soxr --with-metadata --with-stdout --with-systemd
sudo make

5) Install
sudo killall shairport-sync
sudo make install
sudo systemctl disable shairport-sync

6) Cleanup
cd ~
sudo rm -rf ./shairport-sync
shairport-sync -V

Regarding spotify-connect-web ... distribution from here:

https://github.com/Fornoth/spotify-connect-web

... is already pre-build with all dependancies as ready-to-go package for armv7+ devices (including Pi3). Effectively, it's just a matter of wget, uncompress to the designated path, run with required parameters and monitor the process. In turn, service start/stop is simple process restart.

I'm not sure if the Spotify Connect as a service should interact with moOde on renderer level (apart from service monitor/start/stop) as front end mobile devices are used as controller in most of the cases. It could work as a sideline service, although integration with moOde GUI is possible, but is it needed to such extent?

Regarding the bitrate, this was investigated a bit and it seems that, by design, Spotify is enforcing the maximum bitrate on endpoint connect devices regardless of the local settings. As suspected bitrate quality is inherited from the account specific settings. Also, did a test with spotify-connect-web/moOde and it seems that transferred streams are indeed at 320 bitrate. Here is the output from the Spotify console:

21:25:32.754 I [offline_manager.cpp:1446 ] Track 1fdf1cb9c238416cb169004b8fe698e8 downloading. File: 160fb497d075f6a43840a0415fd92846f7170636. Bitrate: 320000. Compl: 00 1001

Regarding problems getting the Spotify app key ... not sure if it's semi-automated form as did got the key relatively fast. It was some time ago, but as far as I remember, for "describe your integration" it was "Enabling Spotify Connect on MoOde Pi3 streaming platform" and for the "list Spotify technology" it was "spotify-connect-web open source Arm platform". Then, of course, Spotify username with associated e-mail is needed. I don't see a problem that one key is shared in moOde distribution itself, as otherwise it would be more complicated that each end-user fill the form, wait for the key and upload to moOde.
 
Regarding spotify-connect-web ... distribution from here:

https://github.com/Fornoth/spotify-connect-web

... is already pre-build with all dependancies as ready-to-go package for armv7+ devices (including Pi3). Effectively, it's just a matter of wget, uncompress to the designated path, run with required parameters and monitor the process. In turn, service start/stop is simple process restart.

I'm not sure if the Spotify Connect as a service should interact with moOde on renderer level (apart from service monitor/start/stop) as front end mobile devices are used as controller in most of the cases. It could work as a sideline service, although integration with moOde GUI is possible, but is it needed to such extent?

Regarding the bitrate, this was investigated a bit and it seems that, by design, Spotify is enforcing the maximum bitrate on endpoint connect devices regardless of the local settings. As suspected bitrate quality is inherited from the account specific settings. Also, did a test with spotify-connect-web/moOde and it seems that transferred streams are indeed at 320 bitrate. Here is the output from the Spotify console:

21:25:32.754 I [offline_manager.cpp:1446 ] Track 1fdf1cb9c238416cb169004b8fe698e8 downloading. File: 160fb497d075f6a43840a0415fd92846f7170636. Bitrate: 320000. Compl: 00 1001

Regarding problems getting the Spotify app key ... not sure if it's semi-automated form as did got the key relatively fast. It was some time ago, but as far as I remember, for "describe your integration" it was "Enabling Spotify Connect on MoOde Pi3 streaming platform" and for the "list Spotify technology" it was "spotify-connect-web open source Arm platform". Then, of course, Spotify username with associated e-mail is needed. I don't see a problem that one key is shared in moOde distribution itself, as otherwise it would be more complicated that each end-user fill the form, wait for the key and upload to moOde.

Hi,

It looks similar to Airplay in the way it would be integrated into Moode. For example there would be ON/OFF/Restart, userid, password, app_key and possibly a config screen if there are any settings, then Moode automatically constructs the cmd string and inserts the correct ALSA device and mixer name. They are different depending on whether the audio device is USB or I2S.

The challenge is that I have no way to test it since I don't have a Spotify account.

Another issue is that Spotify has killed off libspotify and is planning to release new API's sometime later this year. Also, concerning App-keys see below from Spotify website. It looks like App-key is tied to an account.

-Tim

Request of new application keys.

The libspotify key generation and retrieval service has been deprecated, along with libspotify.
You may apply to get a key using our App-key Request Form for private, individual usage. Bear in mind that you should do no new development using libspotify.

Spotify App-key Request Form
Please make your request for an app-key through this form.
* Required
Email address *
Your email
Describe your integration: *
Your answer
List the Spotify technology/ies used in your integration: *
Your answer
Your Company:
Your answer
Your Name: *
Your answer
Your e-mail: *
Your answer
Spotify premium account to be connected to app-key: *
Your answer
A copy of your responses will be emailed to the address you provided.
SUBMIT

-Tim
 
I undersand this. But why the moodeaudio player screen doesn't appears on my touchscreen?

Moode audio player is a so-called "headless" player. You control it from another browser. It's by design.

Presumably another Raspberry Pi with touchscreen display could be dedicated as a moode controller, though I haven't done this myself.

I think it would be interesting if the moode player with integrated touchscreen could boot into a browser, controlling its player. Having said that, my main argument for an integrated controller had been that my android phone's browser could not find "moode" or "moode.local" and required an IP address instead. But now I've discovered the 'Pi Music' android app (thanks to another post on this thread), which solves that problem for me. Now that my android phone is a convenient controller, an integrated controller is less important.

Also, I think you'll have trouble finding a clean enclosure for Pi + Touchscreen + DAC. You'll almost certainly have to drill some holes.
 
Hi,
...
The challenge is that I have no way to test it since I don't have a Spotify account.

Another issue is that Spotify has killed off libspotify and is planning to release new API's sometime later this year. Also, concerning App-keys see below from Spotify website. It looks like App-key is tied to an account.
...

I have a premium account and I have just applied for an app-key. Once I get my app-key, I will follow instructions for spotify-connect-web. I should be able to test whether it only works with the spotify account I supplied in the app-key request. (I'll ask a friend to supply their username/password with my app-key.)

Possibly Spotify only uses the login for record-keeping, rather than making it part of the key certification.
 
Honestly, I'm not sure if app-key is tied up to the account itself as I didn't have time to test this further. It's maybe just basic pre-verification (in the form itself) so that request is valid or intended for the right use. Actually, I hardly doubt that it's verified with u/p pairing per each connection request.

Regarding Tim comment about libspotify, as far as I remember code is based on open source librespot instead of the closed source Spotify library.
 
I can confirm that it isn't tied to an account.

I'm using someone else's key and logging in with my username and password, works flawlessly. The account for key is for them to know who is developing the software, not who can connect to it.

As for integration, I thought it would be nice to have at least the current son and artwork show in the Moode console, just like when airplay is configured to send metadata.

If that is not a must, running from source and avoiding an extra server on the RPi could be the better solution.

I have all three working, shouldn't be a problem. But, also having the server on port 4000 "just in case" could be useful as well and since it would run from the precompiled version it requires less libraries installed as it is 'self contained'.

At any rate, everything is working, shouldn't take long.

Tim, do you have a file naming convention that should be followed? Where would you put the source files for this?

Best regards,
Rafa.
 
I can confirm that it isn't tied to an account.

I'm using someone else's key and logging in with my username and password, works flawlessly. The account for key is for them to know who is developing the software, not who can connect to it.

As for integration, I thought it would be nice to have at least the current son and artwork show in the Moode console, just like when airplay is configured to send metadata.

If that is not a must, running from source and avoiding an extra server on the RPi could be the better solution.

I have all three working, shouldn't be a problem. But, also having the server on port 4000 "just in case" could be useful as well and since it would run from the precompiled version it requires less libraries installed as it is 'self contained'.

At any rate, everything is working, shouldn't take long.

Tim, do you have a file naming convention that should be followed? Where would you put the source files for this?

Best regards,
Rafa.

Hi Rafa,

Just zip up the files and instructions and email to me. Moode source tree is at version 3.2 which already has >50 changed files so I'm going to have to re-integrate the code anyway.

-Tim