I am currently using NAudio to capture the sound and it only creates a wav file. I am looking for a way to encode it to an mp3 before saving the file. I found LAME but when ever i try to add the lame_enc.dll file it says "A reference could not be added. Please make sure the file is accessible, and that is a valid assembly or COM component". Any help would be appreciated.
相关问题
- Sorting 3 numbers without branching [closed]
- Graphics.DrawImage() - Throws out of memory except
- Why am I getting UnauthorizedAccessException on th
- 求获取指定qq 资料的方法
- How to know full paths to DLL's from .csproj f
Easiest way in .Net 4.0:
Use the visual studio Nuget Package manager console:
Code Snip: Send speech to a memory stream, then save as mp3:
Just place the lame_enc.dll in bin folder and don't try to add it to reference. After that try this code. Here you can also set bit rate like 64,128,.....
The file
lame_enc.dll
is an unmanaged DLL, meaning that you can't just add a reference to it in your .NET application. You need a wrapper to define what the entry points are and how they're called . Forlame_enc.dll
I use theYeti
wrapper, which can be found in the code attached to this CodeProject article.I posted a step-by-step on how to use this for MP3 encoding in response the question: change format from wav to mp3 in memory stream in NAudio. That should get you started.