Moode Audio Player for Raspberry Pi

Hi Margus,

The rotary encoder driver can be tuned to a particulr encoder by specifying some args when it is started. This can be tested via command line.

1) In System config, turn off the Rotary Encoder
2) ssh pi@moode (pwd = raspberry)
3) /usr/local/bin/rotenc delay_value accel_thres volume_step debug_print

Below are descriptions of each arg and its default value.

/* input args
argv[1] delay_value = number of milliseconds delay for each iteration of the while(1) loop
argv[2] accel_thres = if diff betw current and last encoder position exceeds this value then increase volume step
argv[3] volume_step = number to increment volume knob by for a single step
argv[4] DEBUG_PRINT = print messages 1, no messages 0
*/

int delay_value = 150; /* defaults */
int accel_thres = 3;
int volume_step = 4;
int DEBUG_PRINT = 0;

For your encoder you can either reduce volume_step or increase accel_thres. For example

/usr/local/bin/rotenc 150 3 1 1

Then nano /var/www/worker.php and search for case 'rotaryenc' and change the launch string to include the args except specify 0 as the last arg so debug_print is turned off.

case 'rotaryenc':
$cmd = $_SESSION['w_queueargs'] == 1 ? '/usr/local/bin/rotenc 150 3 1 0 > /dev/null 2>&1 &' : 'killall /usr/local/bin/rotenc > /dev/null 2>&1 &';
sysCmd($cmd);
break;

Regards,
Tim

Thank you!
i'll check that out at weekend

with best, Margus
 
Hi,

Yes the pre-loaded stations. If u want to use different stream urls for the preloaded stations then u would need to update the .pls files and the associated entries in the cfg_radio sql table.

If u know some Linux send me email and I'll explain how to do this.

-Tim

I do, it's been my primary OS for a few years. Thanks for taking the time to do this, no rush.
 
Hi,

The radio station feature in Moode uses a sql table keyed by the direct stream url and it provides an automatic stream link updater that queries the stations permalink (pls file) to see if the stream url has changed. The Soma FM stations and a few others are coded to use the updater.

-Tim

Oh, wow. I sorted how you deal with the logo entry in cfg_radio when I started creating some logos myself, but I never tried to trace what you do with the permalink entry. Do I understand your response to mean that this query and update occurs automagically for whatever station I play if a valid permalink entry exists in the cfg_radio row for that station?

If this is true, then somewhere in Moode Player you can parse .pls files and I was doing a disservice when I submitted station data to you because I always included just the stream URL, often times having downloaded a .pls file so I could strip out the URL.

(Sorry, I'm getting lazy in my old age; I'd rather hear from the designer what the code is supposed to do than try to infer intent by reverse-engineering the php scripts.)

Regards,
Kent
 
Oh, wow. I sorted how you deal with the logo entry in cfg_radio when I started creating some logos myself, but I never tried to trace what you do with the permalink entry. Do I understand your response to mean that this query and update occurs automagically for whatever station I play if a valid permalink entry exists in the cfg_radio row for that station?

If this is true, then somewhere in Moode Player you can parse .pls files and I was doing a disservice when I submitted station data to you because I always included just the stream URL, often times having downloaded a .pls file so I could strip out the URL.

(Sorry, I'm getting lazy in my old age; I'd rather hear from the designer what the code is supposed to do than try to infer intent by reverse-engineering the php scripts.)

Regards,
Kent

This begs the obvious improvement.

If a user adds a .pls uri when adding a new station, moode should just do the right thing, or show a picklist of the streams for the user to pick one.
 
Oh, wow. I sorted how you deal with the logo entry in cfg_radio when I started creating some logos myself, but I never tried to trace what you do with the permalink entry. Do I understand your response to mean that this query and update occurs automagically for whatever station I play if a valid permalink entry exists in the cfg_radio row for that station?

If this is true, then somewhere in Moode Player you can parse .pls files and I was doing a disservice when I submitted station data to you because I always included just the stream URL, often times having downloaded a .pls file so I could strip out the URL.

(Sorry, I'm getting lazy in my old age; I'd rather hear from the designer what the code is supposed to do than try to infer intent by reverse-engineering the php scripts.)

Regards,
Kent

Hi Kent,

The permalink check-and-update occurs just prior to playback. The Soma FM stations plus a few others have the permalink column populated. The stations pls file is downloaded and then the url assigned to File1= is compared against same in the local pls file. If they are different then local pls File1= and associated row in sql table gets updated.

-Tim
 
Last edited:
Hi Kent,

The permalink check-and-update occurs just prior to playback. The Soma FM stations plus a few others have the permalink column populated. The stations pls file is downloaded and then the url assigned to File1= is compared against same in the local pls file. If they are different then local pls File1= and associated row in sql table gets updated.

-Tim

So, why not populate the permalink column if the user enters a. pls uri when adding a new station?

Phil
 
Hi Kent,

The permalink check-and-update occurs just prior to playback. The Soma FM stations plus a few others have the permalink column populated. The stations pls file is downloaded and then the url assigned to File1= is compared against same in the local pls file. If they are different then local pls File1= and associated row in sql table gets updated.

-Tim

Thanks for the explanation, Tim. I hate throwing requests over the wall to add to your endless TODO list (!) so I'll see if I can find some time to do some experiments with your code. Maybe I can come up with a proposal to scratch both Phil's and my itches.

Regards,
Kent
 
Thanks for the explanation, Tim. I hate throwing requests over the wall to add to your endless TODO list (!) so I'll see if I can find some time to do some experiments with your code. Maybe I can come up with a proposal to scratch both Phil's and my itches.

Regards,
Kent

Hi Kent,

Its an interesting idea, should be doable :)

/var/www/command/moode.php
- case 'add station'

/var/www/inc/playerlib.php
- function updStreamLink()
- $_SESSION[$currentUrl]['permalink'] data element is set during worker.php startup as a result of caching the entire cfg_radio table into $_SESSION

/var/www/command/worker.php
- // cache radio station table in session vars

-Tim
 
Hi Mike,

Thats odd. I never see the reconnect screen on LAN or home WiFi but occasionally I see it on AP mode when applying config screen changes.

There's no Moode code that actively monitors the network connection. The front-end Web UI (Javascript) and back end PHP-MPD wrapper are connected via async AJAX GET submitted by the front-end. If the GET times out, the front-end will branch to the reconnect code and then resubmit the GET every 3 secs.

Network interruption will cause GET timeout but maybe high latency network or ??? can also cause timeout. There are several interrelated timeout settings in PHP, NGINX and MPD so not quite sure how to troubleshoot. I'm not getting user reports of "lot of reconnect screens" with Moode 2.7

-Tim

I have about six Raspberry Pi 3-based Moode installations, in different houses and thus networks, all exhibiting the same symptoms.


The common component is, apart from IQ Audio and Raspberry Pi3 hardware and Moode 2.7, is the Sandisk SD cards I am using.

Given that I have had a number of situations where I have lost configuration or Moode has locked up, I am beginning to think that they might be the cause.

Not knowing how the architecture of Moode accesses the SD card, is it possible that a 'bad' SD card can be causing the 'reconnecting' issue?

Most of my units are installed with modern 450/600MB 802.11n routers. In two of the installations, the routers are brand new, latest-gen 802.11n devices, that otherwise operate flawlessly.

Has anyone compiled a list of 'good' SD cards? What do you use?

The ones I have are Class 4 Sandisk 'Ultra' HC units. Checked with 'verify.sandisk.com' to ensure they aren't rebranded clones.
 
I have about six Raspberry Pi 3-based Moode installations, in different houses and thus networks, all exhibiting the same symptoms.


The common component is, apart from IQ Audio and Raspberry Pi3 hardware and Moode 2.7, is the Sandisk SD cards I am using.

Given that I have had a number of situations where I have lost configuration or Moode has locked up, I am beginning to think that they might be the cause.

Not knowing how the architecture of Moode accesses the SD card, is it possible that a 'bad' SD card can be causing the 'reconnecting' issue?

Most of my units are installed with modern 450/600MB 802.11n routers. In two of the installations, the routers are brand new, latest-gen 802.11n devices, that otherwise operate flawlessly.

Has anyone compiled a list of 'good' SD cards? What do you use?

The ones I have are Class 4 Sandisk 'Ultra' HC units. Checked with 'verify.sandisk.com' to ensure they aren't rebranded clones.

Hi Mike,

Probably not sd card. Try a Wifi dongle. Pi3 WiFi/BT adapter can be disabled in System config.

Heres how to switch between integrated adapter and dongle.

http://www.diyaudio.com/forums/pc-based/271811-moode-audio-player-raspberry-pi-454.html#post4830728

-Tim
 
Hi Kent,

Its an interesting idea, should be doable :)

/var/www/command/moode.php
- case 'add station'

/var/www/inc/playerlib.php
- function updStreamLink()
- $_SESSION[$currentUrl]['permalink'] data element is set during worker.php startup as a result of caching the entire cfg_radio table into $_SESSION

/var/www/command/worker.php
- // cache radio station table in session vars

-Tim

Thanks, Tim.

I have to apologize for my senior moment. i have another technical project filling my head (I'm mentoring a local high school robotics team and having to relearn Java---sigh) and didn't reset my brain to Moode mode before I posted. I was focused on what I can edit in a station entry using the GUI and forgot that internally we have this whole subdirectory of .pls files. Hence, Moode can parse .pls files. Doh.

Anyway, I'm on my way to play with the station-edit functionality.

Regards,
Kent
 
I have about six Raspberry Pi 3-based Moode installations, in different houses and thus networks, all exhibiting the same symptoms.


The common component is, apart from IQ Audio and Raspberry Pi3 hardware and Moode 2.7, is the Sandisk SD cards I am using.

Given that I have had a number of situations where I have lost configuration or Moode has locked up, I am beginning to think that they might be the cause.

Not knowing how the architecture of Moode accesses the SD card, is it possible that a 'bad' SD card can be causing the 'reconnecting' issue?

Most of my units are installed with modern 450/600MB 802.11n routers. In two of the installations, the routers are brand new, latest-gen 802.11n devices, that otherwise operate flawlessly.

Has anyone compiled a list of 'good' SD cards? What do you use?

The ones I have are Class 4 Sandisk 'Ultra' HC units. Checked with 'verify.sandisk.com' to ensure they aren't rebranded clones.

Do these players use different power supplies or is that another common denominator? In addition to my own misadventures with subpar power, I note the comment about power in https://www.raspberrypi.org/documentation/installation/sd-cards.md

WiFi is great when it works, but a P-I-T-A when it misbehaves. I have a curious problem of my own where a Moode 2.7 installation on an RPi2B with a CanaKit USB/WiFi adapter loses its WiFi connectivity at least every second day. This is not an issue with Moode per se but with its underlying Linux components, so I haven't mentioned it here. My goals: 1) set up a watchdog which will reliably restart the connection and 2) understand what cause the problem in the first place. Trying to infer root causes from the little info I can find tracing through logs is a bore.

Regards,
Kent
 
Do these players use different power supplies or is that another common denominator? In addition to my own misadventures with subpar power, I note the comment about power in https://www.raspberrypi.org/documentation/installation/sd-cards.md

WiFi is great when it works, but a P-I-T-A when it misbehaves. I have a curious problem of my own where a Moode 2.7 installation on an RPi2B with a CanaKit USB/WiFi adapter loses its WiFi connectivity at least every second day. This is not an issue with Moode per se but with its underlying Linux components, so I haven't mentioned it here. My goals: 1) set up a watchdog which will reliably restart the connection and 2) understand what cause the problem in the first place. Trying to infer root causes from the little info I can find tracing through logs is a bore.

Regards,
Kent
Hi Kent,

I have the same problem with my pi zero and USB Wi-Fi adapter.

Phil
 
Feature request:
A link to the home page and possibly to twitter and support forums in About panel.
By the way, I see that there is an update available, 2016-09-19-TEST, without any announcements

Hi,

Good idea. I'll add to the TODO list.

If u have debug logging turned on then the TEST update will appear. TEST is my work-in-progress update and therefore it should be considered unstable and likely to cause lot of issues.

-Tim
 
Hi,

I've been working on integrating a set of Advanced I2S audio features as described below. These important improvements in Linux audio are not mainstream yet but with the help of several dedicated inmates they will be available in Moode via a kernel select option :)

- 352.8k and 384k sample rates for es9023 and pcm512x codecs
- Integer bit clock divider for es9023 codec for less jitter on 48K and 96K sample rate
- DSD128 via 352.8k sample rate (either DoP or DSD -> PCM on-the-fly)
- Bypass pcm512x oversampling filter via 384k sample rate

No timing yet on Moode 2.8 but in addition to the nice Advance audio feature, there are significant improvements in networking, auto-resampling based on source rate and various bug fixes.

Going off the grid for a while but will drop in as I am able :)

Regards,
Tim