954,535 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Compression/Decompression Wave File to MP3 and Vice Versa

Hello, everybody. Sorry to disturb you all.

Currently, I have a speech recording and playback software developed by Microsoft Visual C++ 6.0. The software is used to train children with speech problem and scores will be calculated and showed at the end of each practice session. The software is able to record and playback real-time.

Children use this software at home and save their practice records in a single floppy disk. Then, children will bring the floppy disk with practice records inside when they return to our centre. There are 20 wave files that must be saved in a single floppy disk. Due to space insifficiency, one floppy disk is 1.44M in capacity.
Total size of 20 wave files = 20*188k = 3,760,000 bytes
Total floppy disk needed = (3,760,000)/1,440,000 = 2.6 floppy disks
But, I must save all the 20 wave files into a single floppy disk

Our problem is we are not able to save all 20 wave files in a single floppy disk. We cant afford a CD-RW for each child and we must use floppy disk. The solution is we have to compress the wave file to save the files in a floppy and decompress the files back to wave file in order to listen to how the children practice at home.

I am totally new to this as the software is written by one of my previous friend who worked together with me in a voluntary speech rehabilitation centre. We need this software to train children in the centre. I work part time there.

But, my problem is how to call any CODEC dll into correct place into my current project platform without causing any bugs? Please forgive me if I have asked a very silly question, I am sorry. After I have added the cpp and h files into my current project paltform, I dont know what should I do next.

My final destination is to save all 20 wave files in a single floppy disk. I didnt restrict that I must use compression/decompression methods but I dont know what else should I use.

Hope you can give me some guidances on how to do it or you please link me to pages that help me to do so. I promise I can learn as independent as possible but I really need your guidance at this very beginning, please.

Please, I really appreciate all your help.

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

So do you want a DLL that converts MP3 to and from Wav format?
Or Do you want to know how to call a DLL that you already have?

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 
So do you want a DLL that converts MP3 to and from Wav format? Or Do you want to know how to call a DLL that you already have?


Hi, WolfPack, thank you very much for your reply, really appreciate much.

I didnt write a dll on our own but I managed to find some CODEC source codes from the websites but my problem is I dont know how to call a DLL from my software project platform.

Could you please guide me some or link me to the page that got the DLL together with its tutorial or details on how to call the DLL from my software?

Please help, I really need some guidance at this very beginning, I promise I will learn as independent as possible. But I just need helps in this very beginning, please, appreciate

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Okay then I assume you have the DLL with you. So you should have the documentation of that DLL also. That is you must know the functions available, what the functions do, and what are the parameters the functions need to execute properly. After looking up for those in the documentation you can refer this site, which is an example on How to call the

myPuts


function in the

Myputs DLL


. I think it is fairly straightforward, but you can ask if you run into further problems.

I must also say that I appreciate what you are doing to help those kids with speech problems.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Okay then I assume you have the DLL with you. So you should have the documentation of that DLL also. That is you must know the functions available, what the functions do, and what are the parameters the functions need to execute properly. After looking up for those in the documentation you can refer this site, which is an example on How to call the

myPuts

function in the

Myputs DLL

. I think it is fairly straightforward, but you can ask if you run into further problems.

I must also say that I appreciate what you are doing to help those kids with speech problems.

Hi, WolfPack, thank you very much for your reply, appreciate.

I am still 'digesting' what you said here and I will read about the documentation if I could find one and I hope I can understand.

I try my best and will tell you how I am doing

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Hi, WolfPack, Sorry to disturb, May I ask?

I was confused with the dll. I just want to call the third-party software.exe to help me do the compression and decompression part. Do I need to call the dll? Or, Can I just call the .exe from my software?

Sorry for causing any confusion, I was not clear with dll before I put this thread, after I read the pdf about dll, I think that maybe I dont need to call dll but just call the exe.

Please forgive me, I apologized for the trouble caused by me.

Do you think it is possible to call any CODEC software exe from my software? Which one is easier for a newbie like me?

But, I dont know how can I do so, do you mind to give me some guidance? Please, Please forgive me for my ignorance. I try my best in doing it. Hope you can teach me some. Please.

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Hi, WolfPack, Sorry to disturb, May I ask?

I was confused with the dll. I just want to call the third-party software.exe to help me do the compression and decompression part. Do I need to call the dll? Or, Can I just call the .exe from my software?

Sorry for causing any confusion, I was not clear with dll before I put this thread, after I read the pdf about dll, I think that maybe I dont need to call dll but just call the exe.

Please forgive me, I apologized for the trouble caused by me.

Do you think it is possible to call any CODEC software exe from my software? Which one is easier for a newbie like me?

But, I dont know how can I do so, do you mind to give me some guidance? Please, Please forgive me for my ignorance. I try my best in doing it. Hope you can teach me some. Please.

This depends on the DLL or exe that you are using. So I can't say anything specific. But it is possible to call any DLL or EXE from another program. You could post the documentation in this thread, so that we can take a look and give any specific advice if possible.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

HI, WolfPack, thanks for your post.

I would like to call the lame.exe into my current software and I know where or which location to call the lame.exe from my software.

After I put the lame.exe into my project folder, what codes or command that I should write in order to call the lame.exe to come out?

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Hi, WolfPack, actually it is not necessary for me to use lame. I managed to find many source codes of CODEC from website.

My problem is I dont know how to call the third-party software from my software project.

I could send you the source codes if they help.

I really need some guidance, hope you can guide, I appreciate. Please

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Okay since you are using lame, I will tell you how to use it.
The syntax for using lame.exe is

lame [options] inputfile [outputfile]

So say for example you want to convert the exampleinput.wav to exampleoutput.mp3.

What you have to do is this.
add the line

system( "lame.exe exampleinput.wav exampleoutput.mp3" );


into your program and compile.

put lame.exe and exampleinput.wav to the folder where you have put your program, and run your program. You should find the exampleoutput.mp3 file created inside that folder.

here is a minimal example.

int main()
{
       system( "lame.exe exampleinput.wav exampleoutput.mp3" );
return 0;
}

Compile the above program and put the lame.exe and exampleinput.wav file to the same folder where your program is. Then run it. You should see the results.
For more information refer theusage.txt file that came with the dll file. I have attached it in this post too.

Attachments usage.txt (30.18KB)
WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Hi, WolfPack, I have tried to implement in my current software followed the instrustions given in your post, appreciate your help.

For your info, I put the code in the OnSave so that the lame exe will be executed whenever I click the button 'Save'.

But, what happens is after I record one sentence, I click 'Save', the software prompt me for save file name and the lame.exe came out very fast and disappeared in just a blink. And, I went to check the folder, I couldnt find any .mp3 file.

I am sorry, I think I must have made some mistakes. I wonder where I did wrong. still searching...

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Hi, WolfPack, I have tried to implement in my current software followed the instrustions given in your post, appreciate your help.

For your info, I put the code in the OnSave so that the lame exe will be executed whenever I click the button 'Save'.

But, what happens is after I record one sentence, I click 'Save', the software prompt me for save file name and the lame.exe came out very fast and disappeared in just a blink. And, I went to check the folder, I couldnt find any .mp3 file.

I am sorry, I think I must have made some mistakes. I wonder where I did wrong. still searching...

Well without any code I can't say anything from here. So please post your code. Anyway I have attached a simple script file inside a zip file. You can extract it and put
1. All your wav files
2. Lame.exe
3. the script file Convert_To_MP3.cmd
into a single folder and double click the Script file. All the wav files in that folder will be converted to MP3 files.
If you find that enough for your requirements you can use it freely. Otherwise if you want to find the error in your code, you should post your code.

Attachments Convert_To_MP3.zip (0.33KB)
WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Hi, WolfPack, I have tried steps as stated in your last post.

But, After I double click the script file, it generated LAME REPORT.txt but I didnt get any .mp3 file converted.

Can I paste the code here? I afraid I will be scolded for the big space wasted.

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

What does LAME_REPORT.txt say?

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Hi, WolfPack, the text file is empty
I am sorry to cause this trouble.

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

HI, WolfPack. I mean it generated a file name LAME_REPORT.txt but when I opened, it is empty and nothing inside.

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 
HI, WolfPack. I mean it generated a file name LAME_REPORT.txt but when I opened, it is empty and nothing inside.

:eek: Beats me. It worked at my computer.
Anyway zip your code and attach it in this thread if it is too big. If a wave file is not that big, attach a sample wave file too.

WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Hi, WolfPack, thanks for your reply.

Sorry for the late reply as I forget to save from the computer before I back.

I attached the file folder as below.

Attachments Convert_To_MP3.zip (355.63KB)
cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

Yahoooo. Got it. I forgot to write it for files with spaces in the file name.
Here is a Correct version. Hope it works this time.

Attachments Convert_To_MP3.zip (0.33KB)
WolfPack
Postaholic
Moderator
2,051 posts since Jun 2005
Reputation Points: 572
Solved Threads: 115
 

Hi, WolfPack, thanks for your reply.

I have run it successfully with your latest zip file, thanks.

May I ask some more?

1. After the children complete their practices, they will use your codes to compress and then save in a floppy. Then, they bring the floppy to our centre on the next visits. We (Me and the therapist) need to decompress the MP3 file back to Wave file because our software is designed to play the wave.
May I know how can I decompress back? Is it a big problem?

2. I still get the LAME_REPORT.txt which is empty, did I make any mistake? (I am just asking)

cindy_16051988
Junior Poster in Training
52 posts since Apr 2006
Reputation Points: 10
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You