I know how to read audio data from a microphone. I can send it to Agent without using the Sampler Class. How do you store it on a web host like x10 hosting? Or an FTP server? Does anyone have some sample code? The goal is to listen to it from any browser. I’d like it to remain as uncompressed or A-law mono data at about 20KB/sec, not 44 like a CD. Can you help me get started? I got it working from an Arduino to FTP last year, but I’d like to start from scratch. I never made it easy to play back.
I could store a short sample IN the Agent? Play it back from my agent URL without another host?
The imp’s sampler API is used for audio recording. In the example code provided,
the imp records 16kHz A-law compressed audio, saving each buffer to flash as it is filled by the sampler. When the full message has been saved to flash, the sampler is stopped, wifi powersave is temporarily disabled, and the message is uploaded to the agent. The imp then turns wifi powersave back on, clears the recording flash pages, and puts the flash back to sleep.
When the agent has a new message ready, it can be downloaded via HTTP GET and decoded with the built-in base64 utility in Unix:
curl /getmsg | base64 -D > message.wav
Can I also play the wav file from a browser like
www.myurl/getmsg/message1.wav ?
How do I modify the agent code?
Chrome can’t play ANY type of Wav file outside of the context menu or downloading it first, which means using another application like VLC. Why is it necessary for the Agent to Base64 encode it in the first place? It is not possible to send this data to a browser without it? How is it sent when the URL includes the WAV extension? It doesn’t matter Chrome or Firefox can’t play it anyway.