I need to find a good way to force fade down the sound playback of a moc daemon
I have the following scenario:
I have running a small Ubuntu 12.04 server box with a MOC (musiconconsole) daemon and a custom ruby application.
The ruby application occasionally plays a wav or other soundfile in periodic or event driven scenarios. e.g. at 7 p.m. it plays "store_is_closing.mp3" or something like that.
I also have a MOC daemon running with a mp3 playlist, which plays music the whole day.
I am using ALSA to do the mixing.
Everything works fine but I am missing one point.
If, let's say MOC is playing a song and the ruby app plays a sound file, everything is on the same sound level (obviously). so, you can't understand anything of the sound file played by the ruby app.
I need to find a way to force the MOC daemon to fade down his playback of the song to a defined percentage (let's say 10% of the original sound level) and after the ruby app played the sound file, moc should be toggled back back to the origin sound level.
The MOC daemon can be controlled only with the
mocp
client.If you were using PulseAudio, you could use
pacmd
to change MOC's volume.If you replaced MOC with MPD, you could use
mpc
to change MPD's volume.If you really want to do this with ALSA, you could put the following into
/etc/asound.conf
:and configure MOC to use the ALSA device name
moc_with_volume
instead ofdefault
.If your volume-changing program does not allow to configure its mixer control, you have to monitor the other mixer control and copy its value to the MOC mixer control. This could be done with a program like this:
(Use
amixer controls
to check the actual control names.)