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.

Recommended Answers

All 80 Replies

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?

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

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.

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

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.

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.

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?

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

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 the usage.txt file that came with the dll file. I have attached it in this post too.

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...

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.

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.

What does LAME_REPORT.txt say?

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

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

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.

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.

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.

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)

Hi, WolfPack, thanks for your reply.

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

You are welcome. Glad it worked.

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?

No. It is not a problem. I have attached a decoding script in this message. Put it to the folder where the MP3 files and the lame.exe file contains and run as before. You should get the WAV files.

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

No. I put it there so that if there are any errors and messages they will be stored in that file. That was just for debugging puposes. Don't worry about it.

Hi, WolfPack, thank you very much for your reply, appreciate. I hope I can do something to thank you.

I have downloaded your MP to Wav zip file and I can run it successfully to convert MP3 to wave, thanks.

After I converted back to wave file, I tried to play the wave file in the software but it said that "Unsupported Wave File Format". As I said in previous post, We (Me and the therapist) need to decompress the MP3 file back to Wave file because our software is designed to play the wave of mono, 16kHz and 16 bits.

Forgive my stupidness, in my opinion, I get the error message is due to different format in the wave file that written in your codes and wave file format written in my software before.

About the text file, thanks for your explanation, I am just asking. Thanks.

Okay. I think you have to specify the options you want to LAME.exe in order to get the required MP3 and WAV quality. I am not much of an audio expert but I did some changes to the script files. They are attached here. You can try them and see. After running them in the sample file you gave before I got a new WAV file of the following qualities.

Bit Rate 256 kbps
Audio Sample Size 16 bits
Channels 1 ( mono )
Audio Sample Rate 16kHz
Audio Format PCM

If they are not of the required quality, I suggest you read the usage.txt file I attached in a previous reply and see what are the options that need to be set. There is a place called

SET OPTIONS=

in both the script files so you can change them and try. If you run into any difficulty just ask. Tell me how it comes along.

Hi, WolfPack, thanks for your reply.

I have tried for the latest zip file and I still get the same error.

I have checked the wave files recorded by my software before any conversion (I checked by right click Properties -> Summary) . The format details are just the same after the coversion, 256kbps, 16 bit, 16kHz, 1(mono) and PCM.

Since the format are the same, is it that the error is not caused by this reason? What else should I check or do?

Hi, WolfPack,sorry me again.

I searched in web if I can find any reason. This is what I can find. Maybe I am wrong as I am very new to this. Correct me if I am wrong.

It stated that "The wave file saved from one program can be played by other programs (such as media player). However, the wave file saved by other programs may not be opened by this program. That is because this program only check basic wave file structure. It does not support the wave file with optional wave file structure."

I searched in web if I can find any reason. This is what I can find. Maybe I am wrong as I am very new to this. Correct me if I am wrong.

I don't know. You are the expert in audio.

It stated that "The wave file saved from one program can be played by other programs (such as media player). However, the wave file saved by other programs may not be opened by this program. That is because this program only check basic wave file structure. It does not support the wave file with optional wave file structure."

Okay. Try replacing the

SET OPTIONS="--decode"

line in the Convert_MP3_TO_Wav.cmd file with

SET OPTIONS="--decode -t"

.

Hi, WolfPack, thanks for your reply.

I tried to change by right click "edit" and then change 'decode' to 'decode -t'. I wonder if I edit it in wrong way.

I get the error message of " An invalid file handle was associated with wave file 5c.wav"

I will try on other options based on the usage.txt that you sent me before.

Hi, WolfPack, I wonder is it the little and big endian problem? So, I tried to change to "-x" but the problem is still the same.

still searching on how to fix my problem....

Hi, WolfPack, I wonder is it the little and big endian problem? So, I tried to change to "-x" but the problem is still the same.

still searching on how to fix my problem....

No it is not a little or big endian problem. Can you tell me what is the software you are using to read the wav file? maybe i can search for it's valid wav file format.

Hi, WolfPack, thanks for your post.

The software is written in Micorsoft Visual C++ 6.0 to play wave.

After I add "-t", and after I convert the mp3 abck to wave (the wave file is only 19kB after conversion, I guess something wrong), I use WinAmp to play but it said "Invalid File Type".

I also tried to play wave using my C++ software, it said "Unsupported File Format".

The codes are as below:

void CSpeechDlg::OnPlayWave() 
{
    // TODO: Add your control notification handler code here
    //load the file
    CFileDialog openfile(TRUE,NULL,NULL,OFN_OVERWRITEPROMPT,"Wave File (*.wav)|*.wav|");
 
    if (openfile.DoModal()==IDOK) //prerecorded
    {
        CWave wave;
        wave.Load(openfile.GetFileName());
        if ((wave.GetFormat().nChannels!=1) || (wave.GetFormat().nSamplesPerSec!=16000)
            || (wave.GetFormat().wBitsPerSample!=16) ||(wave.GetFormat().wFormatTag!=1)
            || (wave.m_buffer.GetNumSamples()!=6*16000))
        {
            MessageBox("Unsupported File Format!");
            return;
        }        
         memcpy(wavedata1,wave.GetBuffer(),6*16000*2);
    }
 
    else
    {
        return;
    }
 
    if (openfile.DoModal()==IDOK)
    {
        CWave wave;
        wave.Load(openfile.GetFileName());
        if ((wave.GetFormat().nChannels!=1) || (wave.GetFormat().nSamplesPerSec!=16000)
            || (wave.GetFormat().wBitsPerSample!=16) ||(wave.GetFormat().wFormatTag!=1)
            || (wave.m_buffer.GetNumSamples()!=6*16000))
        {
            MessageBox("Unsupported File Format!");
            return;
        }        
         memcpy(wavedata2,wave.GetBuffer(),6*16000*2);
 
            //open waveform audio for output
        waveform.wFormatTag        =    WAVE_FORMAT_PCM;
        waveform.nChannels        =    1;
        waveform.nSamplesPerSec    =16000;
        waveform.nAvgBytesPerSec=16000*2;
        waveform.nBlockAlign    =2;
        waveform.wBitsPerSample    =16;
        waveform.cbSize            =0;
 
        playtype=2;
 
        if (waveOutOpen(&hWaveOut,WAVE_MAPPER,&waveform,(DWORD)this->m_hWnd,NULL,CALLBACK_WINDOW)) {
            MessageBox("Wave Out Error\n");    }
    }        
    //play both of them at one time
}
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.