Page 1 of 1
Real-time audio to browser through my web server - possible?
Posted: Sat Jun 15, 2013 5:52 pm
by khoney
My Netburner Nano module is acquiring audio and storing it to WAV files on an SD card in raw PCM format. I would like to be able to connect to the Netburner via a web browser and listen to the audio in real time. I've been searching the innanets forever to see if this can be done, maybe with some javascript, but I haven't had any luck. From what I can tell, HTML5 is fine for accessing and playing my WAV files, but I don't see a mechanism to play 'real-time' audio. I've been able to play a 1-hour audio file with low latency, but what I really need as well is to be able to play a real-time sample. Ideas, anyone?
P.S. - hardware is built - no codecs, mp3 chips, etc. allowed.
Re: Real-time audio to browser through my web server - possi
Posted: Sat Jun 15, 2013 7:17 pm
by versamodule
It can be done with Silverlight or Adobe flex.
Here is a demo i made a long time ago using Flex. The NB board has 3, .mp3 files on the SD card. When i point my browser to the board it serves up the app to the browser and then starts streaming the audio file to it. As its streaming it, it starts to play it.
http://www.youtube.com/watch?v=oQCGJUFJ ... e=youtu.be
Re: Real-time audio to browser through my web server - possi
Posted: Sun Jun 16, 2013 6:45 pm
by khoney
Thanks for the link, but I'm already doing that with HTML5 and Javascript. What I want to do is play raw audio in real time. Streaming a pre-existing file is not a problem. I can write the audio to a file in real time, but I'd like to be able to somehow redirect it to a web browser. I hope I'm making sense...
Re: Real-time audio to browser through my web server - possi
Posted: Thu Jun 20, 2013 6:06 am
by khoney
So far, I haven't been able to come up with any proven solutions other than building an entire RTP stack.
Possibilities:
1) Somehow use chunked transfer-encoding to send the wav data?
2) There is a mime type for raw mulaw audio, but I'm not sure what it is typically used for or how the browser handles it.
Any insight would be appreciated.
Re: Real-time audio to browser through my web server - possi
Posted: Wed Mar 05, 2014 8:58 am
by khoney
I'm going to need to be doing this soon. Does anyone have any suggestions for how to take microphone data from the netburner and listen to it in real time from a web browser? I only have the netburner on the server side and a web browser (with javascript allowed) at the client side. HTML5 gets me close, in that it is able to play wav files before they are completely downloaded, but that is non-optimal. Any ideas would be heartily welcomed.
Re: Real-time audio to browser through my web server - possi
Posted: Wed Mar 05, 2014 11:37 am
by Ridgeglider
I think the PeriodicAD examples for the Nano & Mod5441X sample the AD and produce a wav file...
Re: Real-time audio to browser through my web server - possi
Posted: Wed Mar 05, 2014 12:31 pm
by khoney
I've got that part of it covered - it's the playing of real-time audio from a remote client's browser that I'm stuck on. How can I take PCM audio, send it to a browser using HTTP, and listen to it on the browser computer. Most of the so'called streaming audio servers are much more powerful than the Netburner and can do multi-casting etc. I just want a single user to be able to press a LISTEN button on their browser and get near real-time audio obtained by the Netburner.
Re: Real-time audio to browser through my web server - possi
Posted: Wed Mar 05, 2014 12:51 pm
by dciliske
This looks like it might be what you're looking for. My bet is to construct a WAV header of a given length, and when you've depleted that chunk size, immediately begin playback of a new chunk, tricking the player into thinking that it has a full file. That's what I'd try at least...
http://www.html5rocks.com/en/tutorials/webaudio/intro/
-Dan
Re: Real-time audio to browser through my web server - possi
Posted: Thu Mar 06, 2014 6:15 am
by khoney
Thanks for that link, Dan. I recently read that WebAudio isnow supported in Firefox and was beginning to look into it, but never found this link - it's a great one! I think I might be able to get something working using WebAudio as part of the solution. In fact, maybe there's a way to just send raw PCM buffers via XmlHttpRequest and do some type of ping-pong AudioBuffer magic.
Can you tell me if Netburner's HTTP server is HTTP1.1 compliant? Because I had also considered the possibility of creating a wav header with the maximum data length and using chunked transfer-encoding to allow the client to begin using the data right away, but I'd like my solution to avoid writing any type of file to the SD card for real-time monitoring purposes. Is there a way to redirect what would normally be wav file writes into an HTTP response? So like the client request would be for wav data, but not from a file, and somehow the server could fullfull that request by sending out the header, followed by a periodic sequence of data chunks? I hope I'm making sense...