Manipulating wav files

G

Guest

Hey,

I want to break up a wav file using c# into smaller more managable chunks.
I'm thinking a buffer to store part of the file may be the way to go. If
anyone has any suggestions or could recommend libraries or api's that may
help out it'd be greatly appreciated.

Thanks,
Ger
 
G

Guest

Hi,

First, if you need to perform file operations really fast use WinAPI
functions, if its possible using C++ in order to avoid wrappers. But, if you
want to use C# I recommend you to use Win32 API to read the file to avoid the
intermidiate stream that the System.IO use (this is quite anoying when you
look for performance).

You can use System.IO to read and store on a memory stream the contents and
then save them in a filestream, so you can break the file.

Fastest alternative:
The fastest way to read chunks of files is the following:
-Create n buffers of 64Kb (let's say 3)
-The 3rd buffer actually is a memory pointer to the 1st buffer
-Read the file and store them in the different buffers, when the buffer is
filled increment the buffer
-When it reaches the 3rd actually is writting on the first one
-You create a circular file reading, this is damn fast!
-You can have a different thread writing the contents of the already filled
buffers without deadlocking, so you can read and write at the same time.

Hope this helps
Salva
 

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

Top