![]() There are a variety of presets (as defined in the LAME encoder itself) or you can try a direct specification of kilobits per second if you prefer. If you find one where it doesn't work then you'll have to do some sample conversion to get your input data into a compatible format.Īlso you might want to play around with the quality parameter in the LameMP3FileWriter constructor. My test file was 44.1KHz Mono IEEE-float format when decoded, which the Lame codec is quite happy to work with. Weird channel counts, sample formats or sample rates can all cause the MP3 writer to fail. Using (var writer = new 3FileWriter(targetFilename, reader.WaveFormat, ))Ĭall that with the filename of your WMA file (or any other audio file readable by the AudioFileReader class) and the filename you want to save to and let it run: static void Main(string this might run into problems is when your input file is in a format that the MP3 encoder doesn't support. Using (var reader = new (sourceFilename)) I'm using the package direct from nuget myself in this example.Īdd the following method somewhere: static void ConvertToMP3(string sourceFilename, string targetFilename) There is one for Lame and one for WMA, but even after installing them, I can't get any code to work.Ĭreate a new console project, use nuget to add the NAudio.Lame package (which I created to encapsulate the LAME MP3 DLLs). Ideally, I would like to do this in memory, but if I have to write to temporary disk files, it's not the end of the world.Įdit I just discovered that there are more NAudio nuget packages that extend the basic one. So, anyone know how I can get something that will do the job? I've wasted hours trying different code samples, but none of them seem to work with either version of NAudio I can find. The version on github includes the WMAFileReader class, but doesn't seem to include the Mp3Writer class, nor the WaveLib class I've seen in many examples. The one you get from Nuget doesn't include the WMAFileReader class, so there's no way (that i can see) to read wma files. One problem is that there seem to be two versions of NAudio around, and neither seems complete. Convert WMA to MP3 using VLC Media Player. Also read: The Best Free WMA Converter You Can Use On Windows 2. Step 5.When the conversion is finished, switch to the Converted tab and you can check the converted file by pressing the Show in folder button. ![]() I've been trying NAudio, but without any success. Step 4.Click on Convert to start the WMA to MP3 conversion. I need a solution that I can integrate into my code base, not rely on an external resource, so using ffmpeg isn't an option. Once completed, click icon to find the new files on your device. It shows you a progressing bar to see the converted and remaining part. That uses classes I couldn't find, as detailed in my question below. Click convert icon at the bottom right corner to start to batch convert WMA to MP3 on Windows 10/11 right away. Please note This is NOT a duplicate of the other question linked.
0 Comments
Leave a Reply. |