Topic: Play sound with a remote call?

I've read the page explaining how to send events to the control panel.

http://wiki.chumby.com/index.php/Chumby … trol_Panel

This works well and allows me to call items from another application.
for example, the application can send the command to force the chumby to jump to the next widget

http://10.10.10.231/cgi-bin/custom/next_widget

with the following:
chumby:/psp/cgi-bin# more /www/cgi-bin/custom/next_widget

#!/bin/sh
echo "HTTP/1.1 200 ok"
echo "Content-type:  text/html"
echo ""
echo "<event type=\"WidgetPlayer\" value=\"nextWidget\" comment=\"\"/>" > /tmp/flashplayer.event
chumbyflashplayer.x -F1 > /dev/null 2>&1


Using the above technique, can I navigate to a URL which would play a certain sound file?

ie:  something like the following...

http://10.10.10.231/cgi-bin/custom/play_test_sound

If not, how would I go about doing this?

thanks

Re: Play sound with a remote call?

I found the following..I'm not sure if it's the cleanest, but it seems to work..

chumby:/psp/cgi-bin# more  sound_test2

#!/bin/sh
btplay http://10.10.10.41/soundfile.wav


soundfile.wav resides on a remote server and is called by accessing the following:

http://10.10.10.231/cgi-bin/custom/sound_test2

Re: Play sound with a remote call?

The problem with using btplay directly is that the Control Panel is unaware of it.

Fortunately, there's another event for playing audio:

<event type="UserPlayer" value="play" comment="http://path.to.stream"/>

...so, you can modify the first script to issue that command:

echo "<event type=\"UserPlayer\" value=\"play\" comment=\"http://10.10.10.41/soundfile.wav\"/>" > /tmp/flashplayer.event
chumbyflashplayer.x -F1 > /dev/null 2>&1

Re: Play sound with a remote call?

Is it possible to send a dynamic name of the sound file?
I'd like the Chumby to be able to speak a file that isn't already named on the Chumby.

ie:
http://10.10.10.231/cgi-bin/custom/soun … er_app>


This file would be created by the application and then the Chumby would play this file.





Duane wrote:

The problem with using btplay directly is that the Control Panel is unaware of it.

Fortunately, there's another event for playing audio:

<event type="UserPlayer" value="play" comment="http://path.to.stream"/>

...so, you can modify the first script to issue that command:

echo "<event type=\"UserPlayer\" value=\"play\" comment=\"http://10.10.10.41/soundfile.wav\"/>" > /tmp/flashplayer.event
chumbyflashplayer.x -F1 > /dev/null 2>&1

Re: Play sound with a remote call?

If you can't make the server that is serving up the sound file deliver a "dynamic" file, can whatever is making the request to the chumby make the decision?  For example, if the requesting application can pass the dynamically decided file as a "get" variable in the URL, the script on your chumby could process that.

You can parse a variable called "soundfile" in your URL like this:

#!/bin/sh

DYNAMIC_FILE=`echo "$QUERY_STRING" | sed -n 's/^.*soundfile=\([^&]*\).*$/\1/p' | sed "s/%20/ /g"`

echo "HTTP/1.1 200 ok"
echo "Content-type:  text/html"
echo ""
echo "<event type=\"UserPlayer\" value=\"play\" comment=\"http://10.10.10.41/${DYNAMIC_FILE}\"/>" > /tmp/flashplayer.event
chumbyflashplayer.x -F1 > /dev/null 2>&1

The URL would look like this in your browser: http://chumby.ip/cgi-bin/custom/playsou … ynamic.wav

Linux Guy - Occasional Chumby Hacker

Re: Play sound with a remote call?

thanks for all the tips..
I now have my home automation (MisterHouse) sending speech (CallerID, calendar items, etc..) to my Chumby :-)