Moode Forum
[IDEA] Play a sound at Moode startup - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Feature requests (https://moodeaudio.org/forum/forumdisplay.php?fid=8)
+--- Thread: [IDEA] Play a sound at Moode startup (/showthread.php?tid=1558)

Pages: 1 2 3


RE: Play a sound at Moode startup - Tim Curtis - 06-15-2025

(06-15-2025, 06:16 PM)marlab Wrote:
Quote:Meantime go to the 'Audio' tab and under 'MPD Options' there is 'Autoplay after start' This will play the last track played on a restart.


That's not a solution, unfortunately. We are asking to play a short audio clip to let the user know that the startup is completed and the system is ready, and also to reset the external DAC at the same time. 
This is the feature I liked on Volumio as well...

It could be implemented but most audio gear, at least in my experience doesn't use a startup chime so I've always had a hard time understanding the need for it.

What exactly is the usage scenario where a startup chime is needed as opposed to just opening the WebUI?

What do you mean by "reset the external DAC"?


RE: Play a sound at Moode startup - Tim Curtis - 06-20-2025

I did end up implementing this but in a more generalized way by use of a customizable "Ready Script" thats run after moOde startup completes.

Here's some specifics:
- It defaults to playing a pleasant chime to indicate the system is ready
- The chime is a flac file thats added to the Queue and then played
- There is a System Config setting to turn the Ready Script on/off
- The script can be customized but you are on your own in this case ;-)

[attachment=4780]

ETA: Here are moode startup log entries for Ready Script

Code:
.
.
20250620 072127 worker: --
20250620 072127 worker: -- Startup complete
20250620 072127 worker: --
20250620 072127 worker: Mount monitor:    started
20250620 072127 worker: Radio monitor:    off
20250620 072127 worker: Watchdog monitor: started
20250620 072127 worker: Responsiveness:   Default
20250620 072127 worker: Ready
20250620 072127 worker: Ready script enabled
20250620 072127 worker: Script started
20250620 072127 worker: Script result: Play OSDISK/System Sounds/ReadyChime.flac
20250620 072127 worker: Script finished



RE: Play a sound at Moode startup - romain - 06-20-2025

(06-20-2025, 12:10 PM)Tim Curtis Wrote: I did end up implementing this but in a more generalized way by use of a customizable "Ready Script" thats run after moOde startup completes.

Here's some specifics:
- It defaults to playing a pleasant chime to indicate the system is ready
- The chime is a flac file thats added to the Queue and then played
- There is a System Config setting to turn the Ready Script on/off
- The script can be customized but you are on your own in this case ;-)



ETA: Here are moode startup log entries for Ready Script

Code:
.
.
20250620 072127 worker: --
20250620 072127 worker: -- Startup complete
20250620 072127 worker: --
20250620 072127 worker: Mount monitor:    started
20250620 072127 worker: Radio monitor:    off
20250620 072127 worker: Watchdog monitor: started
20250620 072127 worker: Responsiveness:   Default
20250620 072127 worker: Ready
20250620 072127 worker: Ready script enabled
20250620 072127 worker: Script started
20250620 072127 worker: Script result: Play OSDISK/System Sounds/ReadyChime.flac
20250620 072127 worker: Script finished

Nice feature Cool


RE: Play a sound at Moode startup - Nutul - 06-20-2025

One thing (I know I am overthinking, but...)
Keep an eye on your volume(s), as you do not want to blast your speakers and/or your eardrums...


RE: Play a sound at Moode startup - Tim Curtis - 06-20-2025

(06-20-2025, 04:47 PM)Nutul Wrote: One thing (I know I am overthinking, but...)
Keep an eye on your volume(s), as you do not want to blast your speakers and/or your eardrums...

Practicing volume safety is always a good idea but since the startup chime is simply a flac thats added to the MPD Queue and played, the volume will always be the current MPD playback volume as set by the user or if MPD volume is set to Fixed (0dB) then its the level of the downstream volume control (Preamp, etc.). From a volume perspective, it's equivalent to the existing "Autoplay after start" feature. In either case the user controls the volume.

There is an alternative method to play a startup chime that involves using the ALSA aplay command. This doesn't require add/play to MPD Queue but the aplay command does not have any volume control, that has to be implemented separately and would require duplicating all the existing MPD volume management code including the case where CamillaDSP volume is used.


RE: Play a sound at Moode startup - marlab - 07-08-2025

(06-15-2025, 09:29 PM)Tim Curtis Wrote: What do you mean by "reset the external DAC"?

First of all, thank you very much for adding the feature! 

What I meant there were older devices (including mine) that after power-on are in a kind of unstable state, occasionally producing noise or crackling sounds, until they receive an actual digital audio input signal. No idea why it happens, but it does. Maybe old electronic design failure. That's why such a feature is a nice remedy if an actual music isn't played shortly after the audio system is powered on.

About "mind the volume" - a very good point. My solution was to use a short audio sample with volume significantly reduced (eg. with Audicity), so it would not blow my speakers or cause heart attack if previously the volume was left at a high value.

Another idea for such a script could be to add a command to reduce volume (eg. to 20%) before playing any audio.

Let me test the new function...


RE: Play a sound at Moode startup - marlab - 07-08-2025

After some testing... unfortunately, it does not work with RPi4 (because mpc cannot play local files on Raspian without some changes in mpd config).
But since we have the ready-script.sh script working, it was easy to use aplay (do not forget to specify your default device in /etc/asound.conf file.)


RE: Play a sound at Moode startup - Nutul - 07-08-2025

(07-08-2025, 07:01 PM)marlab Wrote: After some testing... unfortunately, it does not work with RPi4 (because mpc cannot play local files on Raspian without some changes in mpd config).
But since we have the ready-script.sh script working, it was easy to use aplay (do not forget to specify your default device in /etc/asound.conf file.)

That was my first thought... why not use aplay...?


RE: Play a sound at Moode startup - Tim Curtis - 07-08-2025

(07-08-2025, 07:47 PM)Nutul Wrote:
(07-08-2025, 07:01 PM)marlab Wrote: After some testing... unfortunately, it does not work with RPi4 (because mpc cannot play local files on Raspian without some changes in mpd config).
But since we have the ready-script.sh script working, it was easy to use aplay (do not forget to specify your default device in /etc/asound.conf file.)

That was my first thought... why not use aplay...?

Because aplay does not have volume control. It uses whatever the ALSA volume level happens to be

For example if the audio device supports ALSA volume i.e., "Hardware volume" and the user chooses to use MPD Software volume or a CamillaDSP config whereby CamillaDSP volume is automatically configured then ALSA volume will be at 0dB.

In this case if aplay is used to play the startup chime then watch for smoke coming out the tweeters ;-)


RE: Play a sound at Moode startup - Nutul - 07-08-2025

Agree. No need to fight.