OUR NETWORK:TechLore Explore3DTV MyOpenRouter MediaSmart home Pogoplugged See all... About UsAdvertiseContact Us

 
Learn about scoring Forum's Raw Score: 468528.0
January 5, 2009 12:34 PM

Categories: Rovio

Rating (0 votes)
Rate This!

Member Avatar

punkouter

Member
Joined: 12/27/2008

I would like to be able to talk to people in the room using that.. anyone come up with anything like that?

I would imagine it would just invovle some .exe that would run the txt2speech API and create a wave and then somehow send it to the rovio  ?

Discussion:    Add a Comment | Comments 1-8 of 8 | Latest Comment

January 5, 2009 1:05 PM

I've done this using MSs speech API in C#. When I get a minute I'll post some source code.

January 5, 2009 1:29 PM

From the API:

Other - GetAudio.cgi
Description
Send audio to server and playback at server side
Grammar
/GetAudio.cgi

The data flow is from client to IPCam, which is different from GetData.cgi.
The audio data must be send with HTTP POST method.
Audio format: 16bit PCM, 8000Hz

Should be able to do this with this information. Looks like the last poster has figured it out. I look forward to his C# code. I'm going to have to do this too. (Rovio yelling "Help Me!" if it gets stuck?)

January 5, 2009 4:18 PM

This works. The audio is very soft so it needs to be boosted, but maybe one of you guys can figure that out and repost a better example.

private void Say(string text)
{
try
{
_rovioAudioSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
System.Net.IPEndPoint remoteEndPoint = new System.Net.IPEndPoint(System.Net.IPAddress.Parse(_rovioIPAddress), _rovioAudioPort);
_rovioAudioSocket.Connect(remoteEndPoint);
textBox1.AppendText(DateTime.Now.ToString() + " : Audio socket connected\r\n");
// Prepare the audio port for sending audio from the PC back to the Rovio
string temp = "POST /GetAudio.cgi HTTP/1.1\r\n" + "User-Agent: AudioAgent\r\n" + "Host: " + _rovioIPAddress + "\r\n" + "Content-Length: 2147483647\r\n" + "Cache-Control: no-cache\r\n" + "\r\n";
szSend = StringToByteArray(temp);
//REVIEW: skipping Credentials
if (_rovioAudioSocket.Send(szSend) == -1)
{
textBox1.AppendText(DateTime.Now.ToString() + " : Error sending initial packet\r\n");
}
Stream stream = new MemoryStream();
byte[] format = new byte[0];
speaker.SetOutputToAudioStream(stream, new SpeechAudioFormatInfo(8000, AudioBitsPerSample.Sixteen, AudioChannel.Mono));
speaker.Volume = 100;
speaker.Rate = -8;
speaker.Speak(text);
stream.Seek(0, SeekOrigin.Begin);
byte[] output = new byte[stream.Length];
stream.Read(output, 0, (int)stream.Length);
_rovioAudioSocket.Send(output);
_rovioAudioSocket.Close();
textBox1.AppendText(DateTime.Now.ToString() + " : Audio socket closed\r\n");
}
catch (Exception ex)
{
textBox1.AppendText(DateTime.Now + " :: " + ex.Message.ToString() + "\r\n");
}
}

January 8, 2009 12:49 PM

Have any app I could have doing this ?

View unverified member's comment - posted by The Cpp

January 31, 2009 4:45 PM

This is just the port you have assigned for communicating with the Rovio (80 by default).

April 12, 2010 1:54 AM

I would greatly appreciate if someone gave an example of using GetAudio.cgi in python.

April 13, 2010 12:20 AM

boltun said:

I would greatly appreciate if someone gave an example of using GetAudio.cgi in python.


Answering my own question:

def say(text):
output = subprocess.Popen('echo "'+text+'" | text2wave -f 8000 -o test.wav',shell=True).communicate()[0]
#Could not find a way to send a file with urllib2
c = Curl()
c.setopt(c.POST, 1)
c.setopt(c.URL, 'http://'+username+':'+password+'@'+url+'/GetAudio.cgi')
c.setopt(c.HTTPPOST, [("file", (c.FORM_FILE, "test.wav"))])
try:
c.perform()
except:
pass
c.close()

Discussion:    Add a Comment | Back to Top | Comments 1-8 of 8 | Latest Comment

Add Your Reply

(will not be displayed)

Email me when comments are added to this thread

 
 

Please log in or register to participate in this community!

Log In

Remember

Not a member? Sign up!

Did you forget your password?

You can also log in using OpenID.

close this window
close this window