473,324 Members | 2,248 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

Manipulating wav files

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
Nov 17 '05 #1
2 2554
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
"clojinted" wrote:
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

Nov 17 '05 #2

Thanks very much Salva, I'll give it a shot.

Ger

"Salvador" wrote:
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
"clojinted" wrote:
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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Kristian Nybo | last post by:
Hi, I'm writing a simple image file exporter as part of a school project. To implement my image format of choice I need to work with big-endian bytes, where 'byte' of course means '8 bits', not...
3
by: genc_ ymeri at hotmail dot com | last post by:
Hi, I have some text files and all I need is to look for a certain word a replace it with another one. What is the best way of doing this ? Thank You very much for any tip, G.Y. PS: I'm...
10
by: Segfahlt | last post by:
I have a fairly simple C# program that just needs to open up a fixed width file, convert each record to tab delimited and append a field to the end of it. The input files are between 300M and...
2
by: Ido Flatow | last post by:
Hi all, I've been exploring the way I can manipulate WSDL.exe using SchemaImporterExtension in order to create a proxy to my liking. My situation is as follows - I have a web site that has...
1
by: Ben Keshet | last post by:
Hi Pythoneers, I have a question about a code I wrote with the help of someone. The code below copy a few lines from different files into one file. It works fine as it is given here and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.