Listen to wav file C# - c#

What I am wanting to do is have my program listen to a wav file that consists of highs and low and be able to determine what one is what
(basically converting the highs and lows in the wav files to 1's and 0's)
After some googling I haven't found anything that would be able to listen to an audio source or wav file directly to do this so I am currently stumped on what to do next...

I recommand you to take a look at the NAudio library which allow you to read a WAV file very easily.
Then you will probably need to detect the "highs and lows" yourself by analysing the databytes extracted from your WAV file and create the output file you are looking for also with NAudio (this is basically analysing and filling byte arrays).
This is a usefull article that can help you to understand how to do this :
Audio Formats - Mark Heath
And some other threads directly on stack : How to read the data in a wav file to an array

Related

Which sub-chunks should I support in my wav audio decoder program?

I am writing my own music player, starting with the wav file format. I'm able to play and seek wav files, and now I'm wondering which of the sub-chunks I should try to parse or which I should skip over. The fmt and data chunks are obviously necessary, and I assume INFO is pertinent too. Are there any other sub-chunks that I shouldn't be skipping over?

Split the audio file by words

There is audio file. Where few "words" with different time between them. I need to make as many .wav files as "words" in the file. Audio file is very clear, there is no noise, so it must be very easy to find the "words". Any ideas how to make it with C#? Maybe somebody knows any libraries?
Please check an example of waveform of the file:
NAudio is good. You'll be able to read the WAV header so you know what format was used to store the file. Then you can just scan it and grab the regions where the entropy is higher.
https://naudio.codeplex.com/releases/view/612263

Rendering a wav file from wav files in c#

I got some short .wav files and after i get sequence how it should be played in time I need to "render" a one wav file which will contain that .wav files. I know I can append it but the problem is that some wav files should be played at one time, and also it need to be in rhythm (exact spaces).
How?
You will need to use some libraries like ffmpeg or SoX to do this.
Reference: http://ffmpeg.org, http://sox.sourceforge.net

How to get sound portion of an MP4 (video file)?

I am developing a windows phone 7 application and it does video recording. I would like to get the sound portion of the video file (MP4) and do some enhancements on the sound. I believe sound is saved as AAC frames in MP4. (Right?) How can I extract sound of a videa MP4 file?
Since this is a video file, it can be huge file. So uploading to cloud and processing there is not a good option. Since this WP7 application I cannot use unmaged dlls :( Is there a way to do in pure C#? Any open source tools/samples?
Thanks!
MP4 is a container format and realistically the sound portion isn't always AAC. It could be MP3 or any other number of different audio formats. You may be thinking of M4A, which I believe requires either AAC or ALAC.
On the subject of audio extraction, it should be possible to extract the audio from an MP4 using just managed code. You'll have to read up on the MP4 format (here, for example - this question is also worth reading) and then search through the file for the location of the audio and then either copy it to its own buffer or do your manipulations in chunks. Even then, you'll have to be able to recognize when it isn't an audio format that your app won't support.
It's possible that there already exists a .net library that can do all of this but I don't know of any. It's probably not very popular because managed code is definitely not the best angle to approach this from, but considering this is Windows Phone, it is, as you noted, your only avenue of approach.
Good luck!

Change Audio Format in C#

I want to change an audio file format into another. Specifically, I want to convert any audio file into 6khz, 16 bit, mono, PCM wav format.
How can I cope with this problem.
Thanks again in advance.
You can also do this using the open source C# audio library NAudio. Have a look at the NAudioDemo project for an example of passing WAV files through the ACM codecs installed on your machine to convert to another format. If your input file is not WAV or MP3, you will first need something that converts it to WAV though.
I would use the BASS Library. It has many possibilities to do format conversions using the built in encoding/decoding capabilities. It also has a .NET wrapper availabe.
I'm not entirely sure whether you'll be able to do this as well as you may like.
To start with refer to the windows API for dealing with RIFF files (that's the file group for WAV files.)
You'll need to read the headers, extract the data and uncompress it to get the raw data format. I beleive that the header data will tell you what codec was used for compression.
You'll need to perform some processing on the raw data. Conversion to mono and 16bit may not be a problem, but I'm not too sure about changes to the sampling rate.
You can then recompress using your specified codec.

Categories