Click here to Skip to main content
Click here to Skip to main content

DLL To Decode MP3 To WAV/PCM

By , 12 Jul 2004
 

Sample Image - madlldlib.gif

Introduction

libmad is a powerful open source library written in C that decodes MP3 files to uncompressed PCM data. However, it compiles as a static library, limiting its access to C/C++. I have written code (based on the source madlld) that compiles to a DLL, enabling other languages (i.e., C#, Visual Basic etc.) to access the libmad library using the simple interface I've provided.

Programming the API

The DLL source is well documented, so I will concentrate on using the API, and allow the curious to poke around the guts on their own (it is likely that the API is of most interest to most people). However, a brief overview of the source is in order.

madlldlib is codified into a single, simple interface, consisting of just one function, CbMpegAudioDecoder(), which takes the names of the input and output files, and a callback function as parameters. The callback function is passed information about the decoding process (such as total bytes converted and frame count) as it decodes, which in turn can be used to update decoding status in whatever interface the developer chooses.

There is a small file, test.cpp, included in the source which demonstrates the API. It is kept as simple as possible to make it easy to understand.

First, test.cpp defines a function called mycb(). This function is the callback (function pointer) that madlldlib will send decoding status to. It is within this function that you will update status in your application. test.cpp merely formats the output and prints it to STDOUT.

void __stdcall mycb (unsigned long fcnt, 
   unsigned long bcnt, struct mad_header *mhdr) {

    /*
     * If this is the first iteration (frame count is one)
     * then print out the MP3 layer information. Using this logic
     * one can retrieve information about the MP3 file, such as 
     * channels, layer, etc., that might be useful to the calling
     * code.
     */    
    if (fcnt == 1) {
        printf("frame:%d, tot. bytes:%d, layer:%d\n",fcnt,bcnt,mhdr->layer);
    }
    else {
        printf("frame:%d, tot. bytes:%d\n",fcnt,bcnt);
    }
    
}

As you can see, the output is very simple. You must define a function in your code with exactly the parameter types that mycb() has defined above (the names of the parameters, obviously, are up to you).

Next, we move into the main() function. After checking arguments and handling filenames, it calls the decoding function CbMpegAudioDecoder() with the given parameters.

    /* call the decoding function with input file,
     * output file, and callback (defined above). */
    if (strcmp(argv[2], "pcm")==0) {        /* output raw PCM */
        status = CbMpegAudioDecoder(argv[1], outf, 0, statmsg, mycb);
    }
    else {                                    /* output as WAV */
        status = CbMpegAudioDecoder(argv[1], outf, 1, statmsg, mycb);
    }

Note that it passed our callback function mycb() to CbMpegAudioDecoder(), which will send it information every decoding loop. The other item of interest is the parameter statmsg, which is used to relay any error messages our function may encounter. If, say, the MP3 file is corrupt, this message will end up in statmsg, which you can use to pass on to the user of your application.

The two files, armslen.cpp and armslen_test.cpp, give an example of decoding while sending status via a named pipe. This way you do not have to use madlldlib as a DLL in your project if you don't desire to. armslen.cpp compiles to an executable that takes parameters similar to test.cpp (input filename, output filename, output format). It then generates a named pipe server, and waits until a client program connects (armslen_test.cpp). Once the client makes the connection, armslen.cpp sends the decoding update status to the named pipe while it decodes the MP3. The client can then pick up, parse, and use the status to update its interface.

Source and Contact

The most current code will always be here.

If you have comments or questions, you can direct them to the mailing list madlldlib-dev.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

gilad-ap
United States United States
Member
No Biography provided

Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board.
Search this forum  
    Spacing  Noise  Layout  Per page   
GeneralMy vote of 5memberRevnge_SevnFold20 Nov '12 - 4:25 
Well done man....Excellent!!!
Generalunable to load DLL 'madlldlib.dll'memberMuwanga Simon Peter27 Mar '10 - 7:48 
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.
QuestionHow to convert 24 bit, 48 KHz, PCM Stereo audio file to 16 bit, 48 KHz, PCM StereomemberProgrammervcpp16 Nov '08 - 20:46 
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
GeneralEndianmemberds494023 Sep '08 - 16:42 
Hi I was just wondering whether the output .dll file is in little or big endian?
 
Cheers
GeneralMemory access error in C#memberpeter.roca16 Sep '08 - 12:14 
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?
Questionhow to build a new dll using this source code?memberflyhawkxjtu8 Apr '08 - 4:18 
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

Questionhow to config this program to 16 bit output?memberflyhawkxjtu8 Apr '08 - 1:32 
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

GeneralConvert mp3 file to byte arraymemberramyam20 Mar '08 - 21:25 
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.
GeneralRe: Convert mp3 file to byte arraymembergilad-ap4 Apr '08 - 7:05 
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.
Questionwhere i find "mad.h" ???membernyamnyam15 Jan '08 - 2:01 
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.
AnswerRe: where i find "mad.h" ???membergilad-ap4 Apr '08 - 6:22 
You must get the libmad source, and then edit the Makefile to point to the mad.h location in that source.
GeneralRe: where i find "mad.h" ???memberFeroz Gora10 Feb '11 - 13:04 
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.
GeneralRe: where i find "mad.h" ???membersungengyu16 Mar '11 - 20:58 
ftp://ftp.mars.org/pub/mpeg/archive/mad-0.14.2b.tar.gz
GeneralRe: where i find "mad.h" ???membersungengyu16 Mar '11 - 20:58 
http://www.underbit.com/products/mad/[^]
 
for more message .
Generalcrash with strcpy and strcat in VC++memberaddicted_to_cpp16 Nov '07 - 11:25 
Dear Mr Gilad-Ap,thank you for source code
 
I tried to recompile the project with MSVC++ 6 but it crashes if you are using
strcpy(outf, argv[1]);
strcpy(outfx, argv[2]);
strcat(outf, outfx);

 
I replaced the char * buffers with 2 std::string and it works perfectly Wink | ;)
 
Thank you very much anyway for posting this source code it will be useful Wink | ;)
QuestionDecode mp3 to wav on visual basic 6memberMario Zaizar29 Jan '07 - 9:38 
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?
AnswerRe: Decode mp3 to wav on visual basic 6memberaddicted_to_cpp16 Nov '07 - 11:20 
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 Smile | :)
AnswerRe: Decode mp3 to wav on visual basic 6 - code sample for DLLmembertsargeant25 Nov '09 - 22:29 
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

GeneralRe: Decode mp3 to wav on visual basic 6 - code sample for DLLmemberPappsegull13 Feb '11 - 15:29 
Thanks tsargeantThumbs Up | :thumbsup: , I did use your sample in my code but it use to crach D'Oh! | :doh:
 
You can download my VB code here: http://www.mediafire.com/?eoebve87v740h[^]
And when compile Avira report virusUnsure | :~
 
Any idea why it use to crachConfused | :confused:
Generalconvert and return blocks[]memberdonperry26 Dec '06 - 6:01 
is it possible to convert just a byte[] array of mp3 to wav?
 
thanks in advance
GeneralRe: convert and return blocks[]membergilad-ap29 Jan '07 - 9:45 
Yes. See my other article, about "madxlib":
 
http://www.codeproject.com/audio/madxlib.asp
 

GeneralLECmemberchenjunxuman19 Oct '06 - 14:37 
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
GeneralExample in C#memberSuPeRRuZaFa19 Jun '06 - 2:05 
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.
GeneralRe: Example in C#membergilad-ap11 Jul '06 - 6:32 
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
 

GeneralRe: Example in C#memberddecoy1 Dec '09 - 2:06 
 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 --

GeneralRe: Example in C#memberddecoy1 Dec '09 - 2:08 
forgot the actual wrapper class...
namespace Mp3Decoder
{
	using System;
	using System.Text;	
	using System.Runtime.InteropServices;
 
	// Alias; see SF_INFO struct:

	using sf_count_t = System.Int64;	
 
	
#if PLATFORM_64
	using size_t = System.UInt64;
#else
	using size_t = System.UInt32;
#endif
	
 
	class MadlldlibWrapper
	{
 

		// Type declarations hence

		public enum mad_layer : int 
		{
			MAD_LAYER_I   = 1,          // Layer I 
			MAD_LAYER_II  = 2,          // Layer II 
			MAD_LAYER_III = 3           // Layer III 
		};
 
		
		public enum mad_mode : int 
		{
			MAD_MODE_SINGLE_CHANNEL = 0,      // Single channel 
			MAD_MODE_DUAL_CHANNEL   = 1,      // Dual channel 
			MAD_MODE_JOINT_STEREO   = 2,      // Joint (MS/intensity) stereo 
			MAD_MODE_STEREO         = 3       // Normal LR stereo 
		};
		
 
		public enum mad_emphasis : int 
		{
			MAD_EMPHASIS_NONE	      = 0,        // No emphasis 
			MAD_EMPHASIS_50_15_US	  = 1,        // 50/15 microsecs emphasis 
			MAD_EMPHASIS_CCITT_J_17   = 3,        // CCITT J.17 emphasis 
			MAD_EMPHASIS_RESERVED     = 2         // Unknown emphasis 
		};
 

		public struct mad_timer_t 
		{
		  long seconds;     // Whole seconds 
		  uint fraction;    // 1/MAD_TIMER_RESOLUTION seconds 
		};
		
 
		[StructLayout(LayoutKind.Sequential), Serializable]	
		public struct mad_header 
		{
			public mad_layer layer;             // Audio layer (1, 2, or 3) 
			public mad_mode mode;               // Channel mode 
			public int mode_extension;          // Additional mode info 
			public mad_emphasis emphasis;       // De-emphasis to use

			public uint bitrate;                // Stream bitrate (bps) 
			public uint samplerate;             // Sampling frequency (Hz) 

			public ushort crc_check;            // Frame CRC accumulator 
			public ushort crc_target;           // Final target CRC checksum 

			public int flags;                   // Flags 
			public int private_bits;            // Private bits 

			public mad_timer_t duration;        // Audio playing time of frame 
		};
 

		// Decoding flags

		public const int DEC_WAV = 1;
		public const int DEC_PCM = 0;
 

 
		// Method declarations hence		
		
		
		
		// Callback function is used to pass values
		// related to the decoding process back to
		// the calling code. Use return value to 
		// cancel conversion (set to false)

		public delegate bool 
		Callback( uint frameCount,  uint byteCount, 
				ref mad_header madHeader);	
		
		
		// Conversion routine referencing callback--
		// see madlldlib.cpp source for details about 
		// this function

		[DllImport("madlldlib.dll",	EntryPoint = "CbMpegAudioDecoder")]
		public static extern int 
		DecodeMP3(
				string inFile,
				string outFile,
				int decodeType,				// WAV or PCM
				// Marshalled status message:
				[MarshalAs(UnmanagedType.LPStr)] StringBuilder statmsg,
				Callback updateFunction			// Callback function
				);
	
 
	} 
 
	
}

 
°°°°°°°°°°°°°°°°°°°°°°°
-- Inter Access Belgium --

QuestionCan I set a Bit Rate of output wave file?memberkom200217 Apr '06 - 23:27 
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.
AnswerRe: Can I set a Bit Rate of output wave file?membergilad-ap11 Jul '06 - 6:29 
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.
Questioncan i set the sample rate and resulotion ?memberh1322 Feb '06 - 20:42 
For example, i want convert a mp3 file to a 8000kbps,16bit wav file. please help me.
AnswerRe: can i set the sample rate and resulotion ?membergilad-ap23 Feb '06 - 4:30 
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.
GeneralRe: can i set the sample rate and resulotion ?memberh1324 Feb '06 - 16:41 
Thank you very much, i'll try it.
GeneralProblem in using madlldlib.dllmembersrimayank11_codeproject7 Feb '06 - 0:21 
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
GeneralConfused like me? A message to codeproject users.memberBrit25 Sep '05 - 12:46 
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
GeneralRe: Confused like me? A message to codeproject users.membergilad-ap26 Sep '05 - 6:04 
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
GeneralWriting own dllmemberVeera Raghavendra30 Jun '05 - 17:28 
Hai..
 
Can you guide me the way to write own dll, that converts mp3 to wav or raw file.
 

Thanking you

 
e.veera raghavendra
GeneralRe: Writing own dllmembergilad-ap12 Jul '05 - 6:16 
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.
Generalnot found mad.hmemberVeera Raghavendra29 Jun '05 - 19:50 
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
GeneralRe: not found mad.hmembergilad-ap30 Jun '05 - 6:18 
See this topic on my forum for an explanation.
GeneralRe: not found mad.hmemberYakovT28 Jun '06 - 22:27 
I have the same problem
 
Please let me know how to fix this bug.
 
Thanking you,
 

Yakov
 
YakovT
QuestionHow to usememberVeera Raghavendra24 Jun '05 - 16:57 
I want to use this dll in my VB application. Please let me know how to do this.
 
Thanking you,
E.Veera Raghavendra.Rose | [Rose]
 
e.veera raghavendra
AnswerRe: How to usemembergilad-ap25 Jun '05 - 11:22 
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.
GeneralRe: How to usememberVeera Raghavendra26 Jun '05 - 19:12 
Can u send me the C# code for verification.
 
Thanking you,

 
e.veera raghavendra
GeneralRe: How to usemembergilad-ap27 Jun '05 - 6:32 
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).

Generaldecode RM to mp3 orwavmemberload77714 Jun '05 - 18:42 
How to decode RM file to mp3 or wav please tell me
GeneralMPEG 2.5memberMarc Meuleman22 Feb '05 - 6:15 
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
GeneralRe: MPEG 2.5membergilad-ap23 Feb '05 - 8:08 
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.
GeneralPartial ConversionmemberChristopher J. Holland9 Nov '04 - 9:38 
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
GeneralRe: Partial Conversionmembergilad-anni-padda9 Nov '04 - 11:20 
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.

GeneralRe: Partial ConversionmemberChristopher J. Holland9 Nov '04 - 12:26 
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
GeneralUsing madlldlib for in-memory conversionmemberleyandrew26 Oct '04 - 8:22 
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 General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Permalink | Advertise | Privacy | Mobile
Web02 | 2.6.130523.1 | Last Updated 13 Jul 2004
Article Copyright 2004 by gilad-ap
Everything else Copyright © CodeProject, 1999-2013
Terms of Use
Layout: fixed | fluid