Search code examples
audiosoxlame

Using lame from within SoxSharp


I've always used this command line to create an mp3 with Bit rate: 32kBit / s and Sample rate: 22050 Hz:

"lame -b 32 --resample 22050 input.wav output.mp3"

Now I wanted to use SoxSharp for that, and it has an mp3 option and uses libmp3lame.dll, so I guess it should work.

However, I'm unable to figure the right parameters.

The available parameters for the mp3 output are listed below.

    Using nSox As Sox = New Sox("d:\dev\projects\sox-14-4-0\sox.exe")

        nSox.Output.Type = FileType.MP3
        nSox.Output.SampleRate = I guess that would be 22050 in my case?
        nSox.Output.Channels = 1 'yep, I want mono
        nSox.Output.Encoding = // not sure what to make of it
        nSox.Output.SampleSize = // not sure what to make of it
        nSox.Output.ByteOrder = // I guess I shouldn't touch that
        nSox.Output.ReverseBits  = // I guess I shouldn't touch that
        nSox.Output.Compression = // absolutely not sure what I should choose here

        nSox.Process("input.wav", "output.mp3")

    End Using

Does anybody see where I should insert my "32"? And is .SampleRate = 22050 correct in my case?? The Windows file property dialogue doesn't give me any real hints if I do it correctly, and Audacity converts the audio to the format of my project.

Thank you very much for the help!


Solution

  • Investigating on the source code of SoxSharp, it can't even handle the most basic lame commands out of the box. Basically everything has to be put in the "CustomArguments" property.