1

I wonder if someone can help me.

I'm trying to add a reference to the LAME MP3 encoder in my VB.Net (3.5) App.

The DLL I'm using (lame_enc.dll v3.98.2) was downloaded from here: http://rarewares.org/mp3-lame-bundle.php

When I try to add the DLL reference to my project, I get an error: "A reference to C:\\Lame_Enc.dll could not be added. Please make sure this file is accessible and that it is a valid assembly or COM component"

I would just assume this was a corrupt download/similar but...

  • The archive passed an integrity test in WinRAR
  • I tried re-downloading it JIC

Next thought - the DLL is b0rked but...

  • I've googled and seen that this is a common issue in vs2005.
  • There are quite a few discussions and none of them seem to have a useful conclusion
  • I've tried the SDK tools "genasm"(3.5) and "TlbExp"(2.0) and both say it's not a valid DLL (As suggested in various threads).

So... I've come to the conclusion it's not a COM DLL or (obviously) a .Net one. It is probably intact but I can't reference it directly with VS.

Previously when I've added non-.Net DLLs, VS has created an INTEROP Class for me. I'd ideally like to achieve similar with this DLL.

Unfortunately, this is about the extent of my ability - Can someone please point me in the right direction for how to use this DLL (or another mechanism to interact with LAME)?

Many thanks in advance for any help

Basic
  • 26,321
  • 24
  • 115
  • 201
  • 1
    Downloading from sites with the word "wares" in the URL? Really? Is that a legitimate site? – David Sep 04 '09 at 03:14
  • I have to admit I shared your suspicion but it's linked from the Lame website and I've seen other positive comments online. – Basic Sep 04 '09 at 18:05

3 Answers3

3

This article uses a different approach at building a wrapper in VB.NET around lame.exe.

Have a look :

http://www.codeproject.com/KB/audio-video/LameShell.aspx?print=true

Jayden
  • 2,656
  • 2
  • 26
  • 31
3

Sounds like it's not a .Net DLL. You'll likely need to obtain a wrapper (Jayden's answer seems to be a wrapper).

As an aside, you're probably going to want to get LAME direct from the source.

Charlie Salts
  • 13,109
  • 7
  • 49
  • 78
  • Understood - The problem is I've seen that ppl have had problems compiling it in C++/Win/VS2008 - Hence going to get a pre-compiled version. I'd appreciate any advice though. – Basic Sep 04 '09 at 18:46
1

This project (in C# albiet but the same principle must apply for VB.NET) refers to using the Lame_enc.dll. You could try downloading the sample project and see what they are doing compared with you :

http://www.codeproject.com/KB/audio-video/MP3Compressor.aspx

Jayden
  • 2,656
  • 2
  • 26
  • 31
  • Yeah, there's a lot of code doing: [DllImport("Lame_enc.dll")] and calling it the same way I would a win32 API. I decided to cheat and write a [very limited] wrapper in c# using the sample code as a starting point and then just reference my DLL from VB I believe I could've done this directly from VB - It's somewhere on my to do list... – Basic Sep 09 '09 at 18:40
  • 1
    (If you're interested, the code you need to look at is in Lame.cs in the yeti.mp3 project of the solution linked above) Thanks again for the help – Basic Sep 09 '09 at 18:41
  • @Basic Am facing a similar problem.....could you please share the wrapper in c# you wrote, or give me directions on what i need to do to resolve this issue. I have been banging my head about it all day, please help – Bitsian Dec 12 '12 at 05:20
  • Hi @Bitsian, This was quite a while ago and I no longer have the code. I was never able to make it work well but remember that downloading the source in the article linked from this answer did enable me to grab an interop DLL that worked. I had subsequent issues with handles not being closed and a memory leak which I was never able to resolve. In the end, I gave up using LAME entirely and launched a process which ran ffmpeg against a file. Not good but it worked. – Basic Dec 12 '12 at 12:16
  • Has anyone been able to use MP3Compressor to convert WAV to MP3 ? – billy Feb 08 '13 at 19:28