For Programmers: Free Programming Magazines  


Home > Archive > ASP .NET > February 2007 > Wav file manipulation.









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Wav file manipulation.
iamnotnot@gmail.com

2007-02-28, 7:09 pm

I have hour long wav files on my server.
I would like the user to be able to download arbitrary chunks of say 5
minutes length from any part of the whole.

I have located a stream reader that will read with an offset, and the
accompanying writer will save the correct 5 mins.
http://www.vbaccelerator.com/home/N...ream/article.a=
sp

However as far as I can see the writer will only save to the servers
filespace. I don't really want to save them to disk then push them to
the user. even if I delete them straight off there are bound to be
temp files filling up eventually.

My real problem is writing the header for the file.

the writer produces a file that looks like this "RIFF&
WAVEfmt D =B1 data =F4=FE =C8=FF etc etc"

The format descriptin is here
http://ccrma.stanford.edu/CCRMA/Cou...cts/WaveFormat/

I need to build this header up byte by byte but I am at a loss as to
how to go about this.

Dim ChunkID As Int16 =3D"RIFF"
Dim chunksize As Int16 =3D4 + (8 + 16) + (8 + stream.Length)
Dim wave As Int16 =3D"WAVE"
'Dim riff As Int16 =3D "fmt "
'Dim riffsize As Int16 =3D 16
'Dim format As Integer =3D 1
etc
however I just get buffer overflows trying to squish things into
int16's... I am not even sure if they are the right things.

If you got this far thank you very much! I guess my real question is
how to go about doing low level byte handling stuff... which I have
never had to do before!

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2010 codecomments.com