By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,280 Members | 2,227 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,280 IT Pros & Developers. It's quick & easy.

Circular Audio Files

P: n/a
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

Oct 13 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Quentin" wrote:
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

Oct 13 '06 #2

P: n/a
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
--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Quentin" wrote:
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

Oct 13 '06 #3

P: n/a
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Quentin" wrote:
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

Oct 13 '06 #4

P: n/a
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

"Peter Bromberg [C# MVP]" <pb*******@yahoo.nospammin.comwrote in message
news:A4**********************************@microsof t.com...
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

--
Co-founder, Eggheadcafe.com developer portal:
http://www.eggheadcafe.com
UnBlog:
http://petesbloggerama.blogspot.com


"Quentin" wrote:
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



Oct 13 '06 #5

P: n/a
"Quentin" <qu********@telkomsa.netwrote in
news:eg**********@ctb-nnrp2.saix.net:
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 : )
Oct 13 '06 #6

P: n/a
Spam Catcher <sp**********@rogers.comwrote in
news:Xn**********************************@127.0.0. 1:
"Quentin" <qu********@telkomsa.netwrote in
news:eg**********@ctb-nnrp2.saix.net:
>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 : )

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 : )
Oct 13 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.