|
|
Comments and Discussions
|
|
 |

|
Well done man....Excellent!!!
|
|
|
|

|
Hi,
Just wanted to share something about DLL not found exceptions.
I got the exception 'unable to load DLL 'madlldlib.dll' . while working with the code for converting a .mp3 to .wav .
This is how I solved it after 'googling' . I added the dll to the Path variable, restarted my IDE(VisualStudio 2008). Launched the application, and all was okay.
References
http://forums.asp.net/t/939729.aspx[^]
Regards,
Simon.
|
|
|
|

|
Hi,
I want to convert 24 bit, 48 KHz, PCM Stereo audio file to 16 bit, 48 KHz, PCM Stereo file using vc++. I don't have any idea how to convert audio files.
Please give me any hint for sample code for conversion process.
Its urgent, please give me any link.
Any classes for conversion in MSDN?
Any information would be extremely helpful.
Thanks
Edit/Delete Message
|
|
|
|

|
Hi I was just wondering whether the output .dll file is in little or big endian?
Cheers
|
|
|
|

|
I'm using the C# example you have on your website and I'm getting a memory access error. NOTE: I'm using visual studio 2008
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at VoiceOverTimeTagApplication.Mp3Decoder.madx_read(IntPtr in_buffer, IntPtr out_buffer, IntPtr mx_house, madx_stat& mxstat)
I'm getting it with every mp3 i try. Any suggestions?
|
|
|
|

|
hi all!
i want to do some change to this source code and want to build a new dll.
how can i do this?
thank you all.
eating cattle,
speaking catttle language,
doing cattle-able things,
become a cattle-alike man
|
|
|
|

|
hi all!
i have read that the output of libmad if 24 bit pcm sample,but i want to get the 16 bit output. how to do this?
where can i get the source code of this lib?
thank you all.
eating cattle,
speaking catttle language,
doing cattle-able things,
become a cattle-alike man
|
|
|
|

|
Can I convert an mp3 file into a byte array? My requirement is to compare 2 mp3 files, so I am looking for some mathematical value so that this comparison is possible.Any pointers on this is appreciated.
|
|
|
|

|
Your best bet is to used madxlib, the successor to this library. You can find it on Google. It returns the data to a buffer (an array) that you can do whatever you need to with.
|
|
|
|

|
i setting and building from your source.
but it is shown the message as below.
Cannot open include file: 'mad.h': No such file or directory.
Do you upload the suitable sample again?.
Thanx.
|
|
|
|

|
You must get the libmad source, and then edit the Makefile to point to the mad.h location in that source.
|
|
|
|

|
I downloaded the madld library from : http://www.bsd-dk.dk/~elrond/audio/madlld/
I don't see any mad.h in the sources. I'm missing something still.
|
|
|
|

|
ftp://ftp.mars.org/pub/mpeg/archive/mad-0.14.2b.tar.gz
|
|
|
|
|
|

|
Hi, I need decode one mp3 file to wav on Visual Basic 6.
But I can't find anything usefull. Can somebody help me.
An example, lib, ocx, dll, any?
|
|
|
|

|
You need to program an ATL or OCX component with VC++ using the source code provided by the author if you want to use this code with VB6
|
|
|
|

|
Sorry to bump an old post... but here is the VB6 solution for the DLL.
Create a new project - copy the DLL into the project folder AND into the C:\Program Files\Microsoft Visual Studio\VB98 folder.
The project should contain a form (Form1) and a module (Module1)
Form1:
contains a text box (text1), a command button (command1) and a label (label1)
copy and paste into form1 code:
'-----------------------------------------------------------------------------------------
Private Sub Command1_Click()
Dim test As String
Dim result As Long
test = Left(Text1.Text, Len(Text1.Text) - 3) & "wav"
result = Mp3TOWav(Text1.Text, test, 1, AddressOf StatusMSG, AddressOf MyCallback)
MsgBox "All Done"
End Sub
'------------------------------------------------------------------------------------------
Module1:
copy and paste into module1
'--------------------------------------------------------------------------------------------------------------------------
Public Declare Function Mp3TOWav Lib "madlldlib.dll" Alias "_CbMpegAudioDecoder@20" _
(ByVal lpFilename As String, ByVal lpOutFilename As String, ByVal lpConType As Long, ByVal StatusMSG1 As String, ByVal mycb As Long) As Long
Public Sub MyCallback(ByVal fcnt As Long, ByVal bcnt As Long, ByVal info As Long)
Form1.Label1.Caption = "Frame Count= " & fcnt & " Byte Count= " & bcnt
Form1.Label1.Refresh
End Sub
Public Sub StatusMSG(ByVal Status As String)
Form1.Label1.Caption = Status
Form1.Label1.Refresh
End Sub
---------------------------------------------------------------------------------------------------------------------------
save your project...
copy an mp3 into the root of c:\
Run the code - type in the name of the mp3 file in the text box - c:\yourfilename.mp3 and click the command button.
That is the basic method to get the dll working in VB6 - have fun.
modified on Thursday, November 26, 2009 4:48 AM
|
|
|
|
|

|
is it possible to convert just a byte[] array of mp3 to wav?
thanks in advance
|
|
|
|

|
Yes. See my other article, about "madxlib":
http://www.codeproject.com/audio/madxlib.asp
|
|
|
|

|
HI ALL:
WHO call tell me how can download the free source or document about LEC,
I spend much time on it . but fine little information.
thks
|
|
|
|

|
I'm very confuse trying to write code in C# using P/Invoke calls to work with this .dll.
Would want someone to post a little code explaining this?
Thanks a lot.
|
|
|
|

|
I do not have an example in C# for madlldlib, but I do include one in my source for madxlib, which performs the same function as this library, but is more flexible. You can download this from my website at
http://www.arbingersys.com/concerns.html#madxlib
|
|
|
|

|
public partial class Form1 : Form
{
[MarshalAs(UnmanagedType.LPStr)] private StringBuilder strBuilder = new StringBuilder("",11000);
MadlldlibWrapper.Callback updateFunction ;
string mp3File = "";
string wavFile = "";
Boolean bCancel = false;
OpenFileDialog Dialog = new OpenFileDialog();
public Form1()
{
InitializeComponent();
updateFunction = new MadlldlibWrapper.Callback(updateFunctionMethod);
}
private Boolean updateFunctionMethod(uint frameCount, uint byteCount,ref Mp3Decoder.MadlldlibWrapper.mad_header madHeader)
{
if (frameCount == 1)
{
this.label1.Text = "Sampelrate: " + madHeader.samplerate.ToString() +
" Bitrate: " + madHeader.bitrate.ToString() +
" Duration: " + madHeader.duration +
" Layer: " + madHeader.layer.ToString();
Application.DoEvents();
}
this.label3.Text = "frame:= " + frameCount.ToString() + " byte:= " + byteCount.ToString();
Application.DoEvents();
if (bCancel) {
return false;
}
else { return true; }
}
private void selectMp3ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Dialog.Filter = "mp3 files (*.mp3)|*.mp3";
Dialog.Multiselect = false;
Dialog.ShowDialog();
if (Dialog.FileName != "") {
this.label3.Text = "";
mp3File = Dialog.FileName;
this.textBox1.Text = Dialog.FileName;
wavFile = Dialog.FileName.Remove(Dialog.FileName.LastIndexOf("."), Dialog.FileName.Length - Dialog.FileName.LastIndexOf(".")) + ".wav";
}
}
private void exitToolStripMenuItem_Click(object sender, EventArgs e)
{
this.Close();
}
private void button1_Click(object sender, EventArgs e)
{
MadlldlibWrapper.DecodeMP3(mp3File, wavFile, 1, strBuilder, updateFunction);
this.label3.Text = "Conversion done!";
}
private void button2_Click(object sender, EventArgs e)
{
this.bCancel = true;
}
}
°°°°°°°°°°°°°°°°°°°°°°°
-- Inter Access Belgium --
|
|
|
|

|
forgot the actual wrapper class...
namespace Mp3Decoder
{
using System;
using System.Text;
using System.Runtime.InteropServices;
using sf_count_t = System.Int64;
#if PLATFORM_64
using size_t = System.UInt64;
#else
using size_t = System.UInt32;
#endif
class MadlldlibWrapper
{
public enum mad_layer : int
{
MAD_LAYER_I = 1, MAD_LAYER_II = 2, MAD_LAYER_III = 3 };
public enum mad_mode : int
{
MAD_MODE_SINGLE_CHANNEL = 0, MAD_MODE_DUAL_CHANNEL = 1, MAD_MODE_JOINT_STEREO = 2, MAD_MODE_STEREO = 3 };
public enum mad_emphasis : int
{
MAD_EMPHASIS_NONE = 0, MAD_EMPHASIS_50_15_US = 1, MAD_EMPHASIS_CCITT_J_17 = 3, MAD_EMPHASIS_RESERVED = 2 };
public struct mad_timer_t
{
long seconds; uint fraction; };
[StructLayout(LayoutKind.Sequential), Serializable]
public struct mad_header
{
public mad_layer layer; public mad_mode mode; public int mode_extension; public mad_emphasis emphasis;
public uint bitrate; public uint samplerate;
public ushort crc_check; public ushort crc_target;
public int flags; public int private_bits;
public mad_timer_t duration; };
public const int DEC_WAV = 1;
public const int DEC_PCM = 0;
public delegate bool
Callback( uint frameCount, uint byteCount,
ref mad_header madHeader);
[DllImport("madlldlib.dll", EntryPoint = "CbMpegAudioDecoder")]
public static extern int
DecodeMP3(
string inFile,
string outFile,
int decodeType, [MarshalAs(UnmanagedType.LPStr)] StringBuilder statmsg,
Callback updateFunction );
}
}
°°°°°°°°°°°°°°°°°°°°°°°
-- Inter Access Belgium --
|
|
|
|

|
Could you please let me know how to change Bit Rate of output wave file. I attempted to change "setup header" but it's not working.
|
|
|
|

|
madlldlib (and it's successor, madxlib) return a WAV bitrate (or frequency) based on the MP3's bitrate. It does not allow you to change this. You could conceivably pass the returned raw WAV data into a resampler to acheive this, however.
|
|
|
|

|
For example, i want convert a mp3 file to a 8000kbps,16bit wav file. please help me.
|
|
|
|

|
Not directly. madlldlib could save it as a WAV file, and then you'd have to modify it from there (resample or compress). madlldlib doesn't have the capabilities to do either of these.
It would actually be better to use madxlib--
http://www.codeproject.com/audio/madxlib.asp
which allows you to get the samples as a byte array. From here you could use something like libsndfile to change the format. Still, this doesn't give you resampling ability, but by using madxlib you would have the bytes and could send them where you needed.
|
|
|
|

|
Thank you very much, i'll try it.
|
|
|
|

|
Dear All,
I am using madlldlib.dll but while generating exe file it throws this error
--------------------Configuration: decoder - Win32 Debug--------------------
Compiling...
test.cpp
Linking...
test.obj : error LNK2001: unresolved external symbol _CbMpegAudioDecoder@20
Debug/decoder.exe : fatal error LNK1120: 1 unresolved externals
Error executing link.exe.
decoder.exe - 2 error(s), 0 warning(s)
Kindly let ms kow what is the solution of this problem.
Mayank
|
|
|
|

|
Trying to get this to run? Notice that it doesn't contain a demo or the "text.exe" shown in the example?
Here's two ways you can make this work:
Method #1:
Download the file "CodeprojectArticle-Mp3toWav-Test.exe" from my website http://www.empiresofsteel.com/html/free.html[^]
I put it there so other people wouldn't have to go through what I did.
Note! You must include madlldlib.dll in the same directory as this executable. The dll is available from the codeproject article.
Method #2:
Here's what I did to make it compile:
(1) Download the source code.
Note: This download contains a makefile, which is foreign to a lot of VS users.
Plus, the makefile contains relative paths to a sound library not included in this download.
(2) Download the mad library (libmad version 0.15.1b) ( http://sourceforge.net/projects/mad[^] ).
It's in .tar.gz format. Hopefully, you have a program that can open it (not sure if winzip does, PowerArchiver does).
(3) Find the libmad.dsp file inside the libmad directory, open in VS, compile it.
(4) Create a new project (preferably a command-line project). Use the code from test.cpp in your project. Include the madlldlib.lib, and make sure to adjust paths so that VS can find all the includes it needs (i.e. madlldlib.h, mad.h).
(5) Correct bugs in the main() that cause the program to crash when it is run. This block of code:
char *outf;
char *outfx;
outf="";
outfx=".";
Should be changed to something like:
char outf[1000];
char outfx[1000];
outf[0]=0;
outfx[0]=0;
Or else "strcat(outf, argv[1]);" will crash the program (it's trying to concatinate to a predefined string with a predefined length).
(5) Compile it and run.
-----------------------------------------------------
Empires Of Steel[^]
-- modified at 18:47 Sunday 25th September, 2005
|
|
|
|

|
Sorry this has generated any confusion. However, there are a few things you should note. I've outlined them below.
Brit wrote:
(1) Download the source code.
Note: This download contains a makefile, which is foreign to a lot of VS users.
Plus, the makefile contains relative paths to a sound library not included in this download.
In the "Makefile" itself there are comments with further instructions directing the user how to modify the paths in order for the compile to work. I chose a Makefile over a VS project because all that was needed to make the sample work was the free SDK. If you already had VS, well fine, you can still work with a Makefile.
Brit wrote:
(5) Correct bugs in the main() that cause the program to crash when it is run. This block of code:
char *outf;
char *outfx;
outf="";
outfx=".";
Should be changed to something like:
char outf[1000];
char outfx[1000];
outf[0]=0;
outfx[0]=0;
This is correct, there is an error in the sample. In the "Source and Contact" section above, however, I have a link that reads "The most current code will always be here." (See below for link.) This was released in Beta (note the version is 1.0b4, which means beta 4), and as such, I knew there would be other revisions. That particular blunder was just an oversight on my part.
If you go to my website, you can download the last revision I've made to this project (beta 8), which has the fix for "test.cpp":
/* append suffix to output file (suffix is
* either 'pcm' or 'wav') */
outf = (char *)malloc(strlen(argv[1])+4+1);
outfx = (char *)malloc(strlen(argv[2])+1);
strcpy(outf, argv[1]);
strcpy(outfx, argv[2]);
strcat(outf, ".");
strcat(outf, outfx);
It can be gotten at
http://www.arbingersys.com/dnlds/madlldlib-1.0b8+dll.zip
Also note that I am no longer maintaining the code for madlldlib past the above revision. I suggest using madxlib, a more robust and flexible source that performs the same function.
-- modified at 11:03 Tuesday 27th September, 2005
|
|
|
|

|
Hai..
Can you guide me the way to write own dll, that converts mp3 to wav or raw file.
Thanking you
e.veera raghavendra
|
|
|
|

|
Well, if you want write one from scratch, then you have a pretty large task ahead of you--you'll have to write a library like libmad that can actually do the MP3 decoding, and add code to create a DLL out of it. Or, you can do what I did, which was wrap code around a library (like libmad) so that it will compile to a DLL.
What is missing from madlldlib, or madxlib, both of which already provide this? Just curious why you would want to start from scratch when either of these would, at the very least, provide an excellent starting point.
|
|
|
|

|
Hai..
When i compile the text.cpp file, it is encountering the error called
fatal error C1083: Cannot open include file: 'mad.h': No such file or directory
Please let me know how to fix this bug.
Thanking you,
e.veera raghavendra
|
|
|
|
|

|
I have the same problem
Please let me know how to fix this bug.
Thanking you,
Yakov
YakovT
|
|
|
|

|
I want to use this dll in my VB application. Please let me know how to do this.
Thanking you,
E.Veera Raghavendra.
e.veera raghavendra
|
|
|
|

|
I do not have any code explaining how to use madlldlib from VB. I've included a C# example, which is probably the closest thing to how VB would have to access the DLL. Basically, you will need to map the structures and variables to equivalent variables in VB along with the functions, and use P/Invoke to call the DLL (assuming you are using VB.NET; if not, I can't help much, because I haven't used VB6 enough).
Another thing you might consider is using my other library madxlib (which, by the way, supercedes this one; it does the same thing but is more flexible). I have on my website an SDK that you can purchase for $10USD that includes further documentation and two VB.NET examples. It can be gotten here.
Hope this helps.
|
|
|
|

|
Can u send me the C# code for verification.
Thanking you,
e.veera raghavendra
|
|
|
|

|
Sorry, I mispoke slightly. The C# source that uses this library is to be found in Aumplib, a C# library I have written. Download it and and look at the files "MadlldlibWrapper.cs" (the P/Invoke code) and "TestMadlldlibWrapper.cs" (which demonstrates using the "MadlldlibWrapper" class).
|
|
|
|

|
How to decode RM file to mp3 or wav please tell me
|
|
|
|

|
Does the dll support mp3 encoded in the mpeg 2.5 format ?
I´m trying to decode a mp3 like that and the dll is getting wrong sampling frequencies and bitrates.
Thanks
|
|
|
|

|
It does support MPEG 2.5. According to the libmad distribution (which madlldlib uses for the actual MP3 conversion):
MAD is a high-quality MPEG audio decoder. It currently supports MPEG-1 and the MPEG-2 extension to lower sampling frequencies, as well as the de facto MPEG 2.5 format. All three audio layers — Layer I, Layer II, and Layer III (i.e. MP3) — are fully implemented.
If you have downloaded the demo from this page, you might think about downloading the latest from my website:
http://www.arbingersys.com/concerns.html#madlldlib
You might also consider downloading and compiling the latest version of libmad.
|
|
|
|

|
Hi,
I built my own WAV Player, with an FFT. I am curious as to how the WinAmp player plays MP3's and displays the FFT of the file. I believe they must do partial conversion. Converting part of the file to PCM, then doing the FFT on that section, rather than converting the whole file at once. I suppose I would have to do some coding to get the DLL to do partial conversion.
Christopher J Holland
|
|
|
|

|
Christopher J. Holland:
"I suppose I would have to do some coding to get the DLL to do partial conversion."
You should be able to use the 'killswitch' variable included in the latest revision of madlldlib (Link). Using it you should be able to run madlldlib against your MP3 file for N iterations, then send the kill signal. This should leave a partially completed conversion.
|
|
|
|

|
Actually, I want to convert part of the MP3, send it through and FFT, then out to the Sound Card. Then, get the next subsequent block and do the same process again.
I want to build something like WinAmp. I have already built an FFT and a WAV Player. Now I am trying to integrate MP3 Functionality.
I noticed that the DLL is just something to be used across compilers. I am programming in MFC, so I can just used the Library instead.
I am not too familiar with the Library, I was just happy when I seen the MP3 to WAV/PCM source code. The Code posted should give me some insight on how to accomplish such a feat. Wish me luck.
TIA,
Christopher J Holland
|
|
|
|

|
Hi!
I just wonder if you can help me figure out if the mad dll can work for me:
In the app i develop mp3's are created "on the fly" and stored in memory (void*).
So is there a way to use your library to convert an mp3 memory buffer to a wav memory buffer (after that it will be played using winmm).
The specific of my app is that it can't store a generated mp3 on a hard drive prior to converting/playing (security requirement).
So i can't use your app as-is right now.
Any ideas would be highly appreciated!
Thank you in advance,
Andrey
|
|
|
|
 |
|
|
General News Suggestion Question Bug Answer Joke Rant Admin
|
Source code to produce a DLL that converts MP3 files to WAV or PCM. It is based on the open source library libmad.
| Type | Article |
| Licence | |
| First Posted | 7 Jul 2004 |
| Views | 242,025 |
| Bookmarked | 77 times |
|
|