I\'m writing an app where I record audio and upload the audio file over the web. In order to speed up the upload I want to start uploading before I\'ve finished recording.
I've managed to stream a wav by using only one data chunk and setting ChunkSize to 0xFFFFFFFF and Subchunk2Size to 0xFFFFFFFF as well. The resulting file is not completely up to the specs but when embedded via <audio>
tag, Chrome plays it in real-time without a problem. Also the downloaded file is playable.
WAV format
Where are you uploading to? Your own site? Sounds like you need some server-side code to take your raw sample uploads and assemble them into a valid WAV file (correct file-length field, one data chunk) on the server.
But if you're really trying to speed up the upload, I'd think you actually want to upload MP3-encoded frames and have the server assemble those into an MP3 file. Which is more complicated, I'm afraid.
You will just have to use a container format that supports appending without editing the header.
I suggest Raw PCM samples. They can be converted to anything else at will.
Audacity will import raw bytes from the File -> Import -> Raw Data menu.
Another option might be a lossless audio codec such as FLAC inside of a streamable container format. (As done by a Czech web radio station)
I notice VLC can compress and stream FLAC-in-OGG from the soundcard. Should be a simple step from there to store or uncompress the stream on the server end.