Reputation: 13141
Does anyone know how to convert GSM audio into PCM WAV via C#? I have tried to find a viable solution on the Internet to no avail.
Upvotes: 1
Views: 5511
Reputation: 205
See code below from http://alvas.net/alvas.audio,articles.aspx#mp3-to-wav-without-desktop-experience
void AnyToWav(string fileName)
{
DsReader dr1 = new DsReader(fileName);
if (dr1.HasAudio)
{
WaveWriter ww = new WaveWriter(File.Create(fileName + ".wav"),
AudioCompressionManager.FormatBytes(dr1.ReadFormat()));
ww.WriteData(dr1.ReadData());
ww.Close();
Console.WriteLine("Done!");
}
else
{
Console.WriteLine("Has no audio");
}
}
Upvotes: 0
Reputation: 386
This is for java, but it should be adaptable to C#:
http://www.jsresources.org/faq_audio.html
Upvotes: 0
Reputation: 75396
Here is a link to a C library that encodes and decodes GSM files:
http://user.cs.tu-berlin.de/~jutta/gsm/gsm-1.0.13.tar.gz
and a link to more information on the subject:
http://user.cs.tu-berlin.de/~jutta/toast.html
It should be possible to either compile the C code as a DLL and call it from a C# application using PInvoke, or else incorporate the methods directly into your C# app.
Once you have the GSM data decoded into sample data, writing it out to a WAV file is very simple.
Upvotes: 1