Simple Audio Converter

This topic is about building an audio converter in C#, C++, and Visual Studio.

Source Audio

For an audio source we use the kahvi011_kennybeltrey-hydrate.mp3 file from the Internet Archive. The original audio format is MPEG Audio Layer 3, 44.1 KHz, Joint Stereo, 136 Kbps, Variable Bit Rate


The following code snippet will take any audio format supported by AVBlocks and will convert it to AAC audio in an ADTS container (*.AAC).

using PrimoSoftware.AVBlocks;

namespace SimpleConverter
    class Program
        static void Main(string[] args)

            var inputInfo = new MediaInfo();
            inputInfo.Inputs[0].File = "kahvi011_kennybeltrey-hydrate.mp3";

            if (inputInfo.Open()) {
                var inputSocket = MediaSocket.FromMediaInfo(inputInfo);
                var outputSocket = MediaSocket.FromPreset(Preset.Audio.Generic.AAC);
                outputSocket.File = "kahvi011_kennybeltrey-hydrate.aac";

                using (var transcoder = new Transcoder()) {

                    if (transcoder.Open())



How to run

Follow the steps to create a C# console application in Visual Studio, but in Program.cs use the code from this article.

Download the kahvi011_kennybeltrey-hydrate.mp3 song from the Internet Archive and save it in bin\x64\Debug under the project's directory.

Run the application in Visual Studio. Wait a few seconds for the Transcoder to finish. The converted file kahvi011_kennybeltrey-hydrate.aac will be in the bin\x64\Debug directory.

Last updated onMarch 10th, 2018 11:16:37 AM