how to decode amr files using c#.net - c#-4.0

I need to decode amr format to pcm format, which is later converted to mp3 using c#.net. But I am hardly finding any library to do so. It seems with NAudio it is not possible. Is there any c# based open source library which can be used to decode this format files?. Presently I am working on windows server 2012(64 bit).
NAudio Code:
public void Decode()
{
.....
var result= new MediaFoundationReader("..\\sample.amr");
// later converted to mp3 here
}

It looks you two guys are doing the same thing: How to convert amr files to mp3 using C#
You typically need to have a [third party] AMR decoder installed and integrated into Windows API (ACM, DirectShow, Media Foundation). Then you will use your favorite library around this API, such as NAudio.
Example of AMR decoder: MONOGRAM AMR Pack.

You're unlikely to find a C# decoder for AMR files. I'd recommend just finding a command-line utility that you can call to convert to PCM. For example, it looks like sox can be used to decode AMR.

Related

Convert SILK encoded data to wav file in python

I was surprised I couldn't find an answer to this from a search - maybe I'm using the wrong search terms.
I have what I suspect is a silk compressed datastream (see below) that I would like to turn into a audio file (something like wav ideally). I'm planning on doing this in python, however I have no idea how to do this - I don't get any reasonable searches for how to decompresses the data with silk - maybe there's no silk packages for python (?).
Silk data:
uz+ACgEAEAELgD4EQgEWAKV4mxnepfmhxKCQxAnKVNaHhKRXPIsmAH5RjXmJV0u+WTmrvgyCKxcraehjo/ZeKcFjksXQZEeOju4hLNv/MAB9KA7ww14Vc0ndYPB7dDXoXTexuxcW0Jg/diMgdH5ijWhe02Ch48KX86qJZYFyZV81AH76qCgh9AXliMdyWEgWTMbRD6xMX37WJALrXlSnxymIloSq2KGwXCcMXzQiSQIrcLVNfqdNJACCluFOIRKPmugUvsLZmnD04X0xhpAuNkwJECK4t51MBOWNWJlCAIDyZlJwWI45EPTjBB6yKyGOclu96qBV2MhFAh1d2J7WDZwe6YxOVu/BGkGcur9qTP85ZRfjANoiQxQrWvpoHFBFBy0AfX6k8XvbSwrk2nUAEP3P6kcmXORKUNKeu8HDnOUflQqtA5AkkTiun77fZrqnimIfWg==
First, validate your assumption that it is SILK.
If you open an encoded binary file, it should start with the header "#!SILK_V3". Your excerpt seems like some base64 encoding (maybe the raw binary?).
If you do get to the real silk data, you can decode it with the original Skype Silk SDK. There is probably no python port for this, but you can invoke external libs from python.
Once decoded, use ffmpeg/Audacity raw import/other to convert to WAV/mp3 and test the audio. Then in python, using the wave library or wavio api should work.

iOS - Convert Audio Format (opus to mp3)

Recently I started to develop application that work with .opus file (Audio Format).
I am working with external SDK that can processor a mp3/wav file, unfortunately my local file is a .opus file and I need to convert it to mp3/wav format in order to process the file.
I read and research a lot around the network to find a solution,
I found the FFmpegWrapper library that can convert two type of Audio Format but when I try to convert .opus to .mp3/ , I get this error: opus codec not supported in WAVE format
I do not know what can be done, I'll be happy to help.
Any information about how to convert .Opus format to any other format will be appreciated.
Thanks
Have you tried using this pod: https://github.com/chrisballinger/Opus-iOS
You can use it to convert your Opus-encoded file to wav, then feed it into your SDK.

How to convert '.opus' file to flac file format

I have an audio file with '.opus' format.
http://img.wbcsrv.com/2017/03/14/4915792368684-41222-919020044692-1489468385000.opus
I need to use it with google cloud speech API. But the google speech API only support some file encodings, specified in https://cloud.google.com/speech/docs/basics#audio-encodings . How can i use 'opus' file format with google cloud speech API?
Is there any way to convert '.opus' file into the specified(googles audio encoding documentation) format or any npm available for do this?
In Node you can use ffmpgeg in several ways, using:
https://www.npmjs.com/package/ffmpeg
https://www.npmjs.com/package/ffmpeg-node
https://www.npmjs.com/package/ffmpeg-static
https://www.npmjs.com/package/ffmpeg-wrap
few more at https://www.npmjs.com/search?q=ffmpeg
The ffmpeg supports Opus according to the docs:
https://www.ffmpeg.org/ffmpeg-codecs.html#opus
https://www.ffmpeg.org/ffmpeg-codecs.html#libopus
https://www.ffmpeg.org/ffmpeg-codecs.html#libopus-1
You may need to use libopus for that:
http://opus-codec.org/downloads/
The ffmpeg also supports encoding FLAC so it can also be used for that part:
https://www.ffmpeg.org/ffmpeg-codecs.html#flac-2
There is not a straightforward way to convert Opus to Flac using Node without any external dependencies but it should be possible using the modules and libraries above.

How to convert amr files to mp3 using C#

I am using NAudio MFT to convert different audio formats to MP3.
Now i want to convert amr file to MP3 using Naudio MFT. But, when i given amr file as input to MFT, it has thrown following exception "Exception from HRESULT: 0xC00D36C4". Is there any way to achieve this?
My C# code:
public byte[] ConvertAMRToMP3( )
{
var data = new MediaFoundationReader("..\\amr\\test.amr");
MediaFoundationEncoder.EncodeToMP3(data, "..\\test.mp3", 128000);
......
}
I am working on windows server 2012 64-bit platform.
Thanks in advance.
0xC00D36C4 is MF_E_UNSUPPORTED_BYTESTREAM_TYPE "The byte stream type of the given URL is unsupported."
There is no support for AMR in Media Foundation codecs.

NAudio - 1.7 - Converting WAV to MP4

I am trying to convert a PCM Wav file recorded with the WasapiLoopbackCapture class to an AAC file. The Wav file is 44100, 32bit, 4 channels.
using (var reader = new MediaFoundationReader("recordedfile.wav"))
{
MediaFoundationEncoder.EncodeToAac(reader, "encodedfile.mp4");
}
However, i get a COMException from the MediaFoundationReader:
Exception from HRESULT: 0xC00D5212
What am i doing wrong here and what would be the proper way to convert from PCM WAV to AAC?
Thanks
This probably means you haven't got an AAC encoder (or something is up with the WaveFormat of your recorded WAV file). What version of Windows are you using?
I battled this problem for a few days before ultimately discovering that you need to install The Microsoft Media Foundation AAC Decoder.
https://superuser.com/questions/819227/how-to-fix-missing-media-foundation-microsoft-aac-audio-decoder-transform-mft-wi
https://www.microsoft.com/en-us/download/confirmation.aspx?id=13283

Resources