Moode Forum
Starting stopping all audio through cmd line - Printable Version

+- Moode Forum (https://moodeaudio.org/forum)
+-- Forum: moOde audio player (https://moodeaudio.org/forum/forumdisplay.php?fid=3)
+--- Forum: Support (https://moodeaudio.org/forum/forumdisplay.php?fid=7)
+--- Thread: Starting stopping all audio through cmd line (/showthread.php?tid=3961)



Starting stopping all audio through cmd line - robiwan - 06-30-2021

Hi all,

I'm trying to setup a system, and I need to be able to stop audio playing in any rendering mode in order to release the ALSA output. curl http://localhost/command/?cmd=stop/play works fine for MPD, but does nothing when playing through Spotify Connect. Ideas how to achieve this?

Regards
/Robert


RE: Starting stopping all audio through cmd line - Tim Curtis - 06-30-2021

The renderers are separate playback receivers each with their own command protocol thats typically managed by the client sending application. I don't know of any command line interfaces to the various protocols except for Bluetooth which can be controlled via /var/www/command/bt.sh

The only other mechanism that moOde provides to stop the audio from a renderer and release the ALSA output is to restart the renderer using moodeutl -R [renderer name]. This will disconnect the renderer and free up the ALSA output. IIRC exception is Squeezelite which by default hogs the output when its started so in this case it needs to be turned off. This part isn't handled by moodeutl -R.

Code:
pi@rp2:~ $ moodeutl --help
Usage: moodeutl [OPTION]
Moode utility programs

With no OPTION print the help text and exit.

-a             Print features availability
-A [add|rm N]  Update features availability
-d             Dump session file (requires sudo)
-D [var name]  Delete session variable (requires sudo)
-e [filename]  Export settings to moodecfg.ini
-i             Import moodecfg.ini
-f             Print supported audio formats
-F             Print full alsacap info
-l             Print moode log
-m             Run system monitor
-o             List audio overlays
-q             Query sql database
-r             Restart servers
-R             Restart renderer [--name]
               [bluetooth | airplay | spotify | squeezelite | roonbridge]
-s             Print system info
-t             Print last 10 lines of moode log and wait
-u             Check radio station urls for playability
-U             Check station urls, list only unplayable
--mooderel     Print moOde release
--revision     Print the hardware revision
--version      Print the program version
--help         Print this help text
pi@rp2:~ $



RE: Starting stopping all audio through cmd line - robiwan - 07-01-2021

Thank you Tim,

Problem with the restarting of f.i. Spotify renderer is that it disconnects the Spotify controller app and sets the renderer output volume to zero. This is a not good from a user experience viewpoint. Have to find some other means to disconnect the ALSA backend.

Regards
/Robert


RE: Starting stopping all audio through cmd line - robiwan - 07-01-2021

Ok, interesting. I used the "disconnect" button in the moode GUI, and it stops the Spotify renderer, disconnecting the client, but apparently does NOT reset the renderer as the volume when reconnecting the Spotify app is the same as before. What does the "disconnect" button do, and can I emulate that from command line?

Regards
/R


RE: Starting stopping all audio through cmd line - Tim Curtis - 07-01-2021

It does same as moodeutl -R which is same as RESTART Spotify in Audio Config


RE: Starting stopping all audio through cmd line - robiwan - 07-01-2021

But something must be different, right? Each time I do moodeutl -R --spotify and then reconnect, the volume is reset to zero, whereas it remains at max if I use the "disconnect" button.


RE: Starting stopping all audio through cmd line - Alaini93 - 07-01-2021

Check maybe the initial volume of Spotify in setting. Spotify will restart with whatever volume you set in settings


RE: Starting stopping all audio through cmd line - robiwan - 07-02-2021

(07-01-2021, 12:24 PM)Alaini93 Wrote: Check maybe the initial volume of Spotify in setting. Spotify will restart with whatever volume you set in settings

Thanks!