How to decompress MP3 to WAV in Windows Store app? - c#

I want to find pitches in raw of wav file using FFT and etc. but before I should to decompress MP3 file.
I am using C# with WinRT, and I'm very limited for third-party libraries which often cause exceptions.

You might try NLayer. It's purely managed code (with no P/Invoke), so it should run just fine in a WinRT app.
Disclaimer: I am a major contributor to NLayer.

Related

Universal Windows Platform (UWP) write image to disk sectors

There are alot of examples of writing files to disk using UWP apis but is it possible to write an image file (.img) to disk using UWP apis + c# much in the same way win32DiskImager does?
There is no UWP API can operate .img file. For C#, you can try with
.NET DiscUtils. DiscUtils is a .NET library to read and write ISO files. However this library still can't be used in UWP apps.
So I'm afraid it's impossible to write an image file (.img) to disk using UWP APIs + C#.

Extracting and splitting a MP3 audio stream from an AVI file

I want to develop a desktop application by programming in C# and using the .Net framework 4.
The goal of my application is to extract a MP3 audio stream from a supplied AVI file.
I have learned from the Internet that an AVI file is a container and it might contain different audio streams.
If the supplied AVI file contains one MP3 audio stream at least then I want to extract it and split it.
I want to split the MP3 audio stream into MP3 audio parts identified with a start time and an end time.
I have looked on the Internet for any .Net library I could use but without success.
Does someone know what documented .Net library would be useful ?
Maybe you can try this:
Simple C# Wrapper for the AviFile Library
It is targeted at AVI video but there might be some clues as how to use the same methods to extract the audio only.
Either use it as-is or use the example to incorporate what you need into your own code.
Since tools for this task already exist, I see no point in creating another one unless you're curious about how to do this yourself and learn something new.
If so, using a ready-made library would defeat the entire idea of learning something which is why I strongly recommend you try implementing the splitter yourself.
You can find descriptions of the AVI file format online, that should get you started.

Filling and playing audio buffer in C# (.NET 4.0)

Where I can found something suitable (library) for .NET 4.0 (C#) capable for following features:
+ Reading mp3/wav samples with direct access to samplebuffer of loaded samples? (for example I want to load mp3 sample and programatically add reverb, chorus, and more custom effects implemented by me)
+ Playing directly audio buffers (arrays of floats)
+ Saving audio buffers to disk as mp3 or wav
Some time ago i found ASIO for .NET and this only works with .NET 3.5, is there something for .NET 4.0? Thank's a lot for your help.
ASIO for .NET won't help you in the cracking of mp3 or wav files. The most modern API in Windows for doing this is Microsoft Media Foundation. These are all COM APIs though, so you're either going to be doing (perhaps painful) COM interop from .NET or (easier) writing a C++/CLI wrapper. If you go the C++/CLI wrapper, you will need to be aware of performance issues (especially with how critical latency is to audio programming).
I'm skeptical that you will get the audio latency you need when programming in .NET. A good audio driver (like ASIO) will get you down to <3ms of latency. So if you are targetting "live audio", you will need to be generating audio buffers quicker than that (unless you are fine with longer latencies). To put it this way, the "time intervals" that the Windows APIs deal with are in 100 nanosecond intervals :).
You likely don't want to have to crack the files yourself. It becomes tedious as it's not only just mp3 and wav. You also have to be aware of how the wav is formatted as well (to account for different bit rates, number of channels, etc.). Using Media Foundation, it will automatically load the write decoder for you, you just give it the file path. Check out this tutorial that shows opening an existing WAV file and writing a new WAV file. I just recently went down this path for a drum sequencer I'm creating, and it's not very painful at all (if you're familiar with COM programming).
The central component in MF that makes this possible is the MFSourceReader.
If you're wanting to play the audio after you modify it, you can look at the sample "RenderExclusiveEventDriven" in the Windows SDK (under "audio" I believe). That's what I did for the drum sequencer as well. Latency won't be an issue and you're just dealing with byte arrays, so manipulating the raw data becomes very easy. Though at this point, you can probably stick with the ASIO .NET route and just use that to play the raw data you get from MFSourceReader.
I don't think there are .NET wrappers around Media Foundation yet (though if somebody has done that work already, feel free to post here as it would be awesome to know).

Is there a .NET library to Normalize PCM WAV

I want to normalize PCM WAV files from client side(Silverlight). I am using ASP.NET MVC on the server side. And I found a C program here
https://neon1.net/prog/normalizer.html
Does anyone know that if there are similar C# libraries that I can use directly?
"Normalizing" audio files is generally not a great idea, since if there is just one sample at full volume, then it will have no effect. A better approach would be to run a dynamic range compressor on the audio.
In Skype Voice Changer I have written sample code that uses NAudio and passes audio through dynamic range compressors. However, as others have said, NAudio isn't directly usable in Silverlight due to interop. But you should be able to copy WaveFileReader, WaveFormat and WaveFileWriter out and compile them without needing to make too many code changes. Also, you won't be able to use the WaveBuffer mechanism for casting between arrays of bytes and shorts/floats, so you need to do the conversion the slow way (e.g. using BitConverter).
Some ideas (aside of trying NAudio or Bass.NET)
Call the compiled c executable
Compile it as a dll and use P/Invoke
Convert the C code to c#

How to convert AMR sound stream to PCM uncompressed stream in .NET

I need to convert an AMR (Adaptive Multi-Rate) audio file recorded in a phone (as a Stream object) to a PCM uncompressed wav audio Stream so it can be processed afterwards for speech recognition. The Speech Recognition doesn't like the AMR format. This is going to be a server application using the Microsoft Speech Platform. I am not sure about using the ffdshow or similar libraries in a .
Right now I am researching NAudio and DirectShowNet to see if they can help me accomplish this but was hoping someone can point in the right direction.
After a lot of searching for a solution for this, I am going to use ffmpeg. It provides the AMR-NB (NB=Narrow Band) decoder. There are a lot of c# wrappers for ffmpeg around; most of them abandoned efforts and one that is up to date but is not free. Just running ffmpeg with the basic parameters provides what I need, plus it is really fast.
I don't like the idea of calling an external process to do the conversion, plus I need to save the AMR stream as a file so it can be converted to a wav file but I believe I can make it work efficiently.

Categories

Resources