Circular Audio Files

  • Thread starter Thread starter Quentin
  • Start date Start date
Q

Quentin

Hi,

I want to save an audio stream into a circular file so that I only keep say
the last hour's audio.

Can anybody help?

Cheers,
Quentin
 
Hmm.
Well the first thing you need to be able to do is to save the audio stream
to a file. Assuming that you have succeeded in that, then you would need to
figure out a way to chop off the last portion of the file,and append to the
front of it in "chunks" of X minutes worth of audio.

Unfortunately, there isn't any kind of "circular file" that I know of, you'd
have to do it by periodically replacing the file contents.

Much of the difficulty revolves around the codec being used. For example, if
its a WAV file, there needs to be a WAV header at the beginning (usually the
first 44 bytes) in which the audio length and properties are specified.

Similar for WMV, ASF, RM etc. files.

Peter
 
Hmm.
Well the first thing you need to be able to do is to save the audio stream
to a file. Assuming that you have succeeded in that, then you would need to
figure out a way to chop off the last portion of the file,and append to the
front of it in "chunks" of X minutes worth of audio.

Unfortunately, there isn't any kind of "circular file" that I know of, you'd
have to do it by periodically replacing the file contents.

Much of the difficulty revolves around the codec being used. For example, if
its a WAV file, there needs to be a WAV header at the beginning (usually the
first 44 bytes) in which the audio length and properties are specified.

Similar for WMV, ASF, RM etc. files.

Peter
 
Hmm.
Well the first thing you need to be able to do is to save the audio stream
to a file. Assuming that you have succeeded in that, then you would need to
figure out a way to chop off the last portion of the file,and append to the
front of it in "chunks" of X minutes worth of audio.

Unfortunately, there isn't any kind of "circular file" that I know of, you'd
have to do it by periodically replacing the file contents.

Much of the difficulty revolves around the codec being used. For example, if
its a WAV file, there needs to be a WAV header at the beginning (usually the
first 44 bytes) in which the audio length and properties are specified.

Similar for WMV, ASF, RM etc. files.

Peter
 
Thanks Peter,

My thinking thus far is to save it in 1 second chunks. I've worked with
circular text files before where it is easy because the data is already
broken up into lines, but the audio part is a bit above me now, which is a
nice challenge.

I'll keep investigating.

Quentin
 
Hi,

I want to save an audio stream into a circular file so that I only
keep say the last hour's audio.

Can anybody help?

Not sure if this will help, but take a look at:

http://www.un4seen.com/

BASS has custom audio streaming - so as long as your stream is circular...
you can loop your files : )
 
Not sure if this will help, but take a look at:

http://www.un4seen.com/

BASS has custom audio streaming - so as long as your stream is
circular... you can loop your files : )


I looked over the BASS API... and I think it can do what you want.

During recording, there is a CallBack Handler. One of the parameters is an
array of Bytes (PCM format). Being PCM, you should be able to just loop
your byte array (or file) over and over. there might be a hiccup where the
file over laps, but additional code can probably take care of that : )
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top