Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Force music play on turn on
#1
Hello,

I have my Moode setup on a RPi Zero 2 W with a Topping E50 USB DAC running inside a closet, connect to a Apple Home Kit AC-plug that I power on/off with my iPhone.

Everytime I power on this setup I have to manually open the closet to turn on the DAC (since it is USB powered).

The other option is to access Moode and put a song playing in MPD (it sends a signal to the DAC via USB and the DAC is auto-powered on).

Since I mainly use with Spotify Connect and did not want, every time I want to hear music, to 1) open the closet to power on the DAC or 2) open the web browser and enter Moode webpage to play a music in MPD and the stop it.

Is there any script that I can put on Moode "power-on" so that it "plays something on MPD for 2 seconds only"?

Thank you!
Reply
#2
Why exactly doesn't the DAC turn on?
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#3
(01-06-2024, 12:04 PM)Tim Curtis Wrote: Why exactly doesn't the DAC turn on?

From what I understand, the Apple Home plug powers on the Pi, which in turn can power the DAC on via the USB, but it looks like the USB is not live (5V I mean) until the Pi plays something... I don't think this is a prerogative of the Pi-Zero.

1. How do you manually turn the DAC on, then, by pressing a button on it? Is there the possibility that the Topping turns indeed ON, but in sleep-mode, and this can be changed in its settings?

2. How can you have the Pi play from Spotify if you do not cast something from your phone? Doesn't it (casting from the phone) force the Pi to play, and hence the DAC to wake up?
Reply
#4
(01-06-2024, 12:04 PM)Tim Curtis Wrote: Why exactly doesn't the DAC turn on?

I think is a Topping thing. Even if I connect the DAC USB power cord on the wall, the DAC always "powers on at sleep mode".

The only way for it to wake up it so use the remote, click on the DAC power button, or send it some music.

The problem is that if I send it some music the MPD gives an error, and only plays after the second "attempt" - I think the moment MPD tries to send music the DAC is on sleep, and the time it takes to wake up is not fast enought (so the second time I try the DAC is already "on" and the music plays nicelly)

Here are the startup logs:

PHP Code:
20240106 192058 worker: --
20240106 192059 worker: -- Start moOde 8 series
20240106 192059 worker
: --
20240106 192059 workerSuccessfully daemonized
20240106 192059 worker
Wait for Linux startup...
20240106 192105 workerLinux startup complete
20240106 192105 worker
Boot config backed up
20240106 192108 worker
Session loaded
20240106 192112 worker
Package holds applied
20240106 192113 worker
File check complete
20240106 192113 worker
Debug logging off
20240106 192113 worker
Reduced logging off
20240106 192113 worker
: --
20240106 192113 worker: -- Audio debug
20240106 192113 worker
: --
20240106 192113 workerALSA cards 0:b1 1:E50 2:empty | 3:empty
20240106 192113 workerMPD config 1:E50 mixer:none cardnum:1
20240106 192113 worker
Mixer name none exists
20240106 192113 worker
Hdwr volumecontroller not detected
20240106 192113 worker
: --
20240106 192113 worker: -- System
20240106 192113 worker
: --
20240106 192243 workerHost    pi4
20240106 192243 worker
Model   Pi-Zero 2 W 1.0 512MB
20240106 192243 worker
moOde   8.3.7 2023-12-07
20240106 192243 worker
RaspiOS 11.6 Bullseye 64-bit
20240106 192243 worker
Kernel  6.1.21 64-bit
20240106 192243 worker
MPD ver 0.23.14
20240106 192243 worker
CPU gov ondemand
20240106 192243 worker
Userid  pi
20240106 192243 worker
Homedir /home/pi
20240106 192243 worker
TimezonePortugal
20240106 192243 worker
Keyboardpt
20240106 192243 worker
USB bootnot available
20240106 192243 worker
File sysexpanded
20240106 192243 worker
HDMI outoff
20240106 192243 worker
Sys LED0off
20240106 192243 worker
Sys LED1 sysclass does not exist
20240106 192243 worker
: --
20240106 192243 worker: -- Network
20240106 192243 worker
: --
20240106 192243 workerEthadapter does not exist
20240106 192244 worker
Wlanadapter exists
20240106 192244 worker
Wlancountry PT
20240106 192244 worker
WlanSSID    myNet
20240106 192244 worker
Wlanother   none
20240106 192244 worker
Wlanrouter  off
20240106 192244 worker
Wlantimeout up to 90 secs
20240106 192244 worker
Wlanconnect to myNet
20240106 192244 worker
Wlansleep   disabled
20240106 192244 worker
Wlanmethod  dhcp
20240106 192244 worker
Wlanaddress 192.168.50.151
20240106 192244 worker
Wlannetmask 255.255.255.0
20240106 192244 worker
Wlangateway 192.168.50.1
20240106 192244 worker
Wlanpri DNS 192.168.50.1
20240106 192244 worker
Wlandomain  lan
20240106 192244 worker
: --
20240106 192244 worker: -- Software update
20240106 192244 worker
: --
20240106 192244 workerAutomatic check off
20240106 192244 worker
: --
20240106 192244 worker: -- File sharing
20240106 192244 worker
: --
20240106 192247 workerSMB file sharing on
20240106 192247 worker
NFS file sharing off
20240106 192247 worker
DLNA file sharingoff
20240106 192247 worker
: --
20240106 192247 worker: -- Audio config
20240106 192247 worker
: --
20240106 192247 workerMPD config   update skipped (USB audio device)
20240106 192247 workerAudio device E50
20240106 192247 worker
Formats      S32_LESPECIALDSD_U32_BE
20240106 192247 worker
Mixer type     CamillaDSP
20240106 192247 worker
Mixer name     none exists
20240106 192247 worker
Hdwr volume  controller not detected
20240106 192247 worker
ALSA card    1
20240106 192247 worker
ALSA mode    Default
20240106 192247 workerALSA loopbackoff
20240106 192248 worker
CamillaDSP   VLS_805_v1_ALIGNED_ESTIMATE
20240106 192248 worker
Renderers    active flags reset
20240106 192248 worker
: --
20240106 192248 worker: -- MPD startup
20240106 192248 worker
: --
20240106 192250 workerMPD service       started
20240106 192250 worker
MPD port 6600     accepting connections
20240106 192250 worker
MPD ALSA Default:   on
20240106 192250 worker
MPD ALSA Bluetoothoff
20240106 192250 worker
MPD HTTP Server   off
20240106 192250 worker
MPD crossfade     off
20240106 192250 worker
MPD ignore CUE    yes
20240106 192250 worker
MPD CDSP volsync  on
20240106 192250 worker
MPD CDSP volrange 60 dB
20240106 192250 worker
: --
20240106 192250 worker: -- Music sources
20240106 192250 worker
: --
20240106 192250 workerUSB auto-mountudisks-glue
20240106 192250 worker
USB drives    no drives found
20240106 192250 worker
NAS source    Downloads
20240106 192250 worker
NAS source    FLAC
20240106 192321 worker
NAS mount     mount all submitted
20240106 192321 worker
: --
20240106 192321 worker: -- Feature availability
20240106 192321 worker
: --
20240106 192321 workerInput select   availablesrc MPDout E50
20240106 192330 worker
Bluetooth      startedPA startedALSA mode Default
20240106 192330 workerAirPlay        started
20240106 192330 worker
Spotify Connectstarted
20240106 192330 worker
Squeezelite    available
20240106 192330 worker
RoonBridge     not installed
20240106 192330 worker
Multiroom      available
20240106 192330 worker
UPnP client    available
20240106 192330 worker
GPIO buttons   available
20240106 192330 worker
Stream recordern/a
20240106 192330 worker
HTTPS-Only moden/a
20240106 192330 worker
: --
20240106 192330 worker: -- Volume levels
20240106 192330 worker
: --
20240106 192332 workerVolume knob     0
20240106 192332 worker
Saved MPD volume0
20240106 192332 worker
Saved SRC volume0
20240106 192332 worker
Hdwr volume     controller not detected
20240106 192332 worker
: --
20240106 192332 worker: -- Peripherals
20240106 192332 worker
: --
20240106 192335 workerLocal display  off
20240106 192335 worker
On-screen kbd  off
20240106 192335 worker
Rotary encoder off
20240106 192335 worker
USB volume knoboff
20240106 192335 worker
LCD updater    off
20240106 192335 worker
: --
20240106 192335 worker: -- Miscellaneous
20240106 192335 worker
: --
20240106 192335 workerAuto-CoverView   off
20240106 192335 worker
CoverView timeoutNever
20240106 192335 worker
Auto-shuffle     off
20240106 192335 worker
Auto-play        off
20240106 192335 worker
Web SSH server   on
20240106 192335 worker
Maintenance task 360 mins
20240106 192335 worker
Current view     reset to Playback
20240106 192335 worker
Session check    ok
20240106 192335 worker
: --
20240106 192335 worker: -- Startup complete 
20240106 192335 worker
: --
20240106 192335 waitWorker(): Start cdsp-configeditorw_active=0
20240106 192335 waitWorker
(): End   cdsp-configeditorw_active=0
20240106 192335 waitWorker
(): Start cdsp-configeditorw_active=0
20240106 192335 waitWorker
(): End   cdsp-configeditorw_active=0
20240106 192335 worker
Mount monitor   off
20240106 192335 worker
MPD monitor     off
20240106 192336 worker
Watchdog monitorstarted
20240106 192336 worker
Responsiveness  Default
20240106 192336 workerReady
20240106 192336 waitWorker
(): Start sys-configw_active=0
20240106 192336 waitWorker
(): End   sys-configw_active=0
20240106 192406 waitWorker
(): Start sys-configw_active=0
20240106 192406 waitWorker
(): End   sys-configw_active=
Reply
#5
(01-06-2024, 01:20 PM)Nutul Wrote:
(01-06-2024, 12:04 PM)Tim Curtis Wrote: Why exactly doesn't the DAC turn on?

From what I understand, the Apple Home plug powers on the Pi, which in turn can power the DAC on via the USB, but it looks like the USB is not live (5V I mean) until the Pi plays something... I don't think this is a prerogative of the Pi-Zero.

1. How do you manually turn the DAC on, then, by pressing a button on it? Is there the possibility that the Topping turns indeed ON, but in sleep-mode, and this can be changed in its settings?

2. How can you have the Pi play from Spotify if you do not cast something from your phone? Doesn't it (casting from the phone) force the Pi to play, and hence the DAC to wake up?

Correct!

1) Yes, via button or remote, and it turns ON in "sleep-mode".

2) That's the main problem I have. I can connect to "Spotify Connect", but when I press play on Spotify it "drops" the connection to moode in Spotify Connect (but the DAC wakes up at that moment). But then I am forced to login into moode and restart the "Spotify Connect" render service in order to be able to connect again from the iPhone to Spotify in order to play music.
Reply
#6
(01-06-2024, 06:31 PM)tiago.trindade Wrote:
(01-06-2024, 01:20 PM)Nutul Wrote:
(01-06-2024, 12:04 PM)Tim Curtis Wrote: Why exactly doesn't the DAC turn on?

From what I understand, the Apple Home plug powers on the Pi, which in turn can power the DAC on via the USB, but it looks like the USB is not live (5V I mean) until the Pi plays something... I don't think this is a prerogative of the Pi-Zero.

1. How do you manually turn the DAC on, then, by pressing a button on it? Is there the possibility that the Topping turns indeed ON, but in sleep-mode, and this can be changed in its settings?

2. How can you have the Pi play from Spotify if you do not cast something from your phone? Doesn't it (casting from the phone) force the Pi to play, and hence the DAC to wake up?

Correct!

1) Yes, via button or remote, and it turns ON in "sleep-mode".

2) That's the main problem I have. I can connect to "Spotify Connect", but when I press play on Spotify it "drops" the connection to moode in Spotify Connect (but the DAC wakes up at that moment). But then I am forced to login into moode and restart the "Spotify Connect" render service in order to be able to connect again from the iPhone to Spotify in order to play music.

The Spotify Connect implementation (librespot) doesn't have a failover capability if the connection to the audio device gets interrupted, it just crashes or hangs. This failure case doesn't occur for most audio devices because they maintain their connection to the host.
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
(01-06-2024, 06:37 PM)Tim Curtis Wrote:
(01-06-2024, 06:31 PM)tiago.trindade Wrote:
(01-06-2024, 01:20 PM)Nutul Wrote:
(01-06-2024, 12:04 PM)Tim Curtis Wrote: Why exactly doesn't the DAC turn on?

From what I understand, the Apple Home plug powers on the Pi, which in turn can power the DAC on via the USB, but it looks like the USB is not live (5V I mean) until the Pi plays something... I don't think this is a prerogative of the Pi-Zero.

1. How do you manually turn the DAC on, then, by pressing a button on it? Is there the possibility that the Topping turns indeed ON, but in sleep-mode, and this can be changed in its settings?

2. How can you have the Pi play from Spotify if you do not cast something from your phone? Doesn't it (casting from the phone) force the Pi to play, and hence the DAC to wake up?

Correct!

1) Yes, via button or remote, and it turns ON in "sleep-mode".

2) That's the main problem I have. I can connect to "Spotify Connect", but when I press play on Spotify it "drops" the connection to moode in Spotify Connect (but the DAC wakes up at that moment). But then I am forced to login into moode and restart the "Spotify Connect" render service in order to be able to connect again from the iPhone to Spotify in order to play music.

The Spotify Connect implementation (librespot) doesn't have a failover capability if the connection to the audio device gets interrupted, it just crashes or hangs. This failure case doesn't occur for most audio devices because they maintain their connection to the host.

True!

That is why I have to mannualy play on MPD (because it has a failover capability) in order to "wake up" the DAC. 
And after that I can use Spotify Connect without problems.

Is there any way/script to force this "MPD play" on startup, for a limit of time/songs (I could create and "empty song" just for that)?
Reply
#8
(01-07-2024, 04:42 PM)tiago.trindade Wrote:
(01-06-2024, 06:37 PM)Tim Curtis Wrote:
(01-06-2024, 06:31 PM)tiago.trindade Wrote:
(01-06-2024, 01:20 PM)Nutul Wrote:
(01-06-2024, 12:04 PM)Tim Curtis Wrote: Why exactly doesn't the DAC turn on?

From what I understand, the Apple Home plug powers on the Pi, which in turn can power the DAC on via the USB, but it looks like the USB is not live (5V I mean) until the Pi plays something... I don't think this is a prerogative of the Pi-Zero.

1. How do you manually turn the DAC on, then, by pressing a button on it? Is there the possibility that the Topping turns indeed ON, but in sleep-mode, and this can be changed in its settings?

2. How can you have the Pi play from Spotify if you do not cast something from your phone? Doesn't it (casting from the phone) force the Pi to play, and hence the DAC to wake up?

Correct!

1) Yes, via button or remote, and it turns ON in "sleep-mode".

2) That's the main problem I have. I can connect to "Spotify Connect", but when I press play on Spotify it "drops" the connection to moode in Spotify Connect (but the DAC wakes up at that moment). But then I am forced to login into moode and restart the "Spotify Connect" render service in order to be able to connect again from the iPhone to Spotify in order to play music.

The Spotify Connect implementation (librespot) doesn't have a failover capability if the connection to the audio device gets interrupted, it just crashes or hangs. This failure case doesn't occur for most audio devices because they maintain their connection to the host.

True!

That is why I have to mannualy play on MPD (because it has a failover capability) in order to "wake up" the DAC. 
And after that I can use Spotify Connect without problems.

Is there any way/script to force this "MPD play" on startup, for a limit of time/songs (I could create and "empty song" just for that)?

There is an option, in the MPD section of AUDIO settings: "Autoplay after start". I believe that if you leave a 3-seconds silence track in the queue, at every startup it will play. You can give it a try, you can use any track for now, if you don't have any empty; that will also notify you when the system is ready to accept Spotify... maybe a short jingle...
Give it a try.
Reply


Forum Jump: