Great advice. You're the most knowledgeable on this topic so far. How about Content-type headers? Are they determined by the file extension automatically? Are they only needed in the HTML5 code? Are they an issue anywhere in this project using HTML5 (not Flash player)?

The most difficult question of all:Can I use an Electric Imp Agent to directly serve the file to the HTML5 page? I have sent the contents of a file this way before including the WAV headers. The path is binary clean so I don't have to BASE64 encode it.

How about Content-type headers? Are they determined by the file extension automatically? Are they only needed in the HTML5 code? Are they an issue anywhere in this project using HTML5 (not Flash player)?

The content-type headers are only applicable to the "download" or users page if the wav is embedded into a html page.(by embedded I mean referenced to as opposed to the actual binary data being part of the webpage).If you only provide a direct link to the wav's URL on the server then the users device will get the wav and play it.

Another thing to consider is the mime-type which is part of the servers configuration, however most servers will have the wav ("audio/x-wav" ) set by default.

Have a look at http://www.awardspace.com/ for your hosting needs.I have used them in the past and no complaints, your millage may vary of course. They even offer a free option with CGI so you can try with no monetary risk and if you like it you can always upgrade.

Quote

The most difficult question of all:Can I use an Electric Imp Agent to directly serve the file to the HTML5 page? I have sent the contents of a file this way before including the WAV headers. The path is binary clean so I don't have to BASE64 encode it.

You don't need to use Electric Imp Agent or anything else.All you need to do is a http file upload.

I will dig up some of my scripts that I use for http file uploads, password and file size checking.

<audio controls> If available and can play it, then play this one -----> sound.wavelse if not available or can't play the one above, try this one ----> sound.mp3if can't find or play either, display this message -------> Your browser does not support the audio element.</audio>

Quote

I know I don't have to use the Electric Imp.I want to use the Imp, for another related project.Can I serve the audio file from the Agent to my HTML5 webpage above?

You will have to check the compatibility (permissions, any modules to be loaded on server) with your hosting provider.

I'm doing it like in the example I linked above. So I need them. What does need them mean? Just specify them in the HTML5 code like above? What if the wav file is coming from another host? How does it send the Content-type headers?

What if the wav file is coming from another host? How does it send the Content-type headers?

I don't quite understand your question.Are you saying that the html page is on one server and the wav file on another?If that is the case, then you would put the fully qualified URL of the wav file on the other server in the code.Note however that depending on server settings, some admins are over paranoid about things like cross-site scripting and set the permissions wrongly and it has unwanted side effects of which one is blocking what you are trying to achieve.

Now this is where it gets interesting with mime-types and content-types.The other server is simply feeding a resource of type wav/x-wav as specified in the mime-types section of it's config and so it's happy, the actual server which has the html code, may need the content-type depending on how it's set up even though it's not actually feeding client with the resource.Some browsers also require it to be present to select the right codec to play it whilst some make the decision based on the extension.Either way it will not hurt to include it.

EDIT:

Welcome to the supposed standard of html. There are plenty of these oddities, for example how different browsers handle the ACCESSKEY tag and even the ALT tag for images which are not standard on all browsers.Firefox and Chrome also handle the new graphics capabilities of html 5 differently causing lots of mayhem and confusion.

No experience in streaming data online, but if you have the chance to choose the data format you have a few options...WAVE PCM 8 bit is unsigned( probably the easiest and lighter to implement on a uC ( good for speech); 16 bit unsigned if you need more quality. Anything else might be a bit too much to handle in real time, specially if the sound is not the main aim of your project/code.Or just PCM , given the chance, of course ! I started documenting the WAVE format from an embedded pont of view, as an option to an add-on for one of my projects.... Gives you a good insight into other related formats as well AVI, RIFF and compression related ones, etc. Hope it comes handy !http://dubworks.blogspot.co.uk/2013/11/wav-file-format-and-brief-intro-into.html