Discussion:
Can Cmus Do This?
Storm Dragon
2012-03-24 23:54:03 UTC
Permalink
Hi,
I am trying to build sound capabilities into a mud client trigger pack.
I am making a soundpack and background music/ambiance for Alter Aeon,
http://www.alteraeon.com/
For command sounds like fireballs, sword slashes, etc I am using sox
because they are just quick clips that take less than a second to play.
Sox also works for ambiance sounds, like in a forest playing bird sounds
and having them pan from one side to the other so it sounds like things
are in different places around you.
The really dificult part, so I am finding, is playing a background sound
for the area. Like, for example, if you are near a stream and the
terrain is stream I would need to play (loop) a bit of running water
sound. But, terrain can change at any time, so if you move to forest, I
need to stop the running water file and load the forest file. It's easy
to do by hand but not so much with code in this trigger pack lol.
So, after all this rambling, my question is, can I get cmus to launch
with no gui, play a file, set volume, and stop playing remotely from
within another program? If so, how do I do it. If it is not possible, do
you know of anything that may work for this?
Thanks
Storm
--
Vinux Publicity Coordinator: http://www.vinuxproject.org/
Registered Linux user number 508465: https://linuxcounter.net/user/508465.html
My blog, Thoughts of a Dragon: http://www.stormdragon.us/
My last.fm profile: http://www.last.fm/user/stormdragon2976
"And for every crossing where two roads diverged. I fell one false decision. But still you find me on this earth."
Van Canto - I Stand Alone
Jason Woofenden
2012-03-25 00:27:37 UTC
Permalink
Hi Storm,

I don't think cmus is a good fit for your project.

Probably what you really should do is write your own program that
stays running and manages the sound. And uses some library like
SDL_mixer or something.

But if you want to do it with shell scripting, you might try
mplayer. You can set mplayer running, and control it with a
pipe. Something like

PIPE="mplayer-control"
if [ ! -e "$PIPE" ]
then
mkfifo "$PIPE"
fi

mplayer -really-quiet -loop 0 forest.wav -input file="$PIPE"&
sleep 40
echo "quit" > "$PIPE"

You could probably fake an acceptable fade-out with -softvol and
sending "volume 90", "volume 80" etc to the pipe.

- Jason
Philipp Schafft
2012-03-26 14:16:05 UTC
Permalink
reflum,
Post by Storm Dragon
So, after all this rambling, my question is, can I get cmus to launch
with no gui, play a file, set volume, and stop playing remotely from
within another program? If so, how do I do it. If it is not possible,
do you know of anything that may work for this?
Already had a look at rpld[0]? It is designed to run as daemon. It can
also be used forked off another process (and comunicating privately with
that process).


[0] http://roaraudio.keep-cool.org/rpld.html
--
Philipp.
(Rah of PH2)
Loading...