views:

70

answers:

0

I have an FCGI application that have to stream audio via HTTP. The audio is composed of 1 to 3 files mixed together. Everything is in plain C.

I'd like to know what will be a good way or library to read the audio files by 1 second chunks, mix them and encode them as an HTTP friendly format.

I need to read the files by chunks because I don't known in advance which files to use, my CGI receive the mixing information in real time, like: play file A, then 2 seconds later, play file B, then 3 seconds later, stop A, play C and D. That's why my idea was to read files according to the playlist, mixing 1 sec, sending them via HTTP and waiting for new info.

Of course, the 1 sec value will be a parameter that could be tuned depending on network performances, as the client are iPhone using 3G.

My questions, to summarize are:

  • How to read the audio files (I can provide any format), I know how to read WAV, but I'd like your opinion.
  • How to encore the stream, what is the best format to use.
  • How to mix the streams to have a constant volume of each stream.