Thread: Compression/Decompression Wave File and MP3

  1. #46
    Registered User
    Join Date
    Apr 2006
    Posts
    28
    Hi, Anonytmouse, thank you very much for your reply, appreciate.

    Thanks for your explanation. Do you mean by using Speex, we could not have all the wave files saved in Temp, only can save one wave file? Correct me if I am wrong. It is OK if really cant.

    May I ask? Can I do the same thing for decoding part?

  2. #47
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    Why would you want to save all the temporary wave files? The idea is that they're only temporary and that the actual sound files are transferred in the .spx format on the floppy disk. Of course, you can do anything, but saving all the wave files with different file names means that we have to come up with some complicated scheme to delete them when they are no longer needed.

    >> Can I do the same thing for decoding part? <<

    What do you mean? For the decoding part, you take all the .spx files are decompress them back to wave files with the speexdec program.

  3. #48
    Registered User
    Join Date
    Apr 2006
    Posts
    28
    Hi, Anonytmouse, thank you for your reply.

    I am sorry, I didnt mean to cause the confuse here, forgive my poor English, I am trying my best to learn it gradually, please dont angry. I am sorry.

    OK, I am just asking, Since it cant save the wave files, ther willnot be a problem for children to bring the floppy disk to centre.

    As I said in the previous post, the error message box came out, what should I do so that the error message wont come out?

    Regarding the decoding part, Can I elaborate a little bit? Originally, the "Play wave" button was designed to function like this: When the child bring the floppy disk back to centre, the therapist will click button "play wave". This button will prompt twice for each click. First prompt is to open wave recorded by therapist's own voice and the second prompt is to open wave recorded by children at home. That's why I am asking Is it possible to implement codes so that the MP3 file can be converted to Wave file when button "Play wave' is clicked?

    Thank you for your patience to read my poor English

  4. #49
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    >> As I said in the previous post, the error message box came out, what should I do so that the error message wont come out? <<

    Comment out the MessageBox line (Put the two "//" back in front of it).

    I've got to log off now, but I can help you with the decoding part tomorrow. It is possible to make the software work as it did before.

  5. #50
    Registered User
    Join Date
    Apr 2006
    Posts
    28
    Hi, Anonytmouse, thank you very much for your reply.

    OK, have a nice day. Thank you

  6. #51
    Registered User VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,607
    The simplest and most expensive way is to get Sony Sound Forge Studio edition (lite edition) and convert the MP3's to WAV's and vice versa.

    Another way to do this is to fire up DirectShow, play the MP3's and read the DSP or query the driver to read the DSP and return the actual values being sent to it. This is what a WAV file is, the pure raw data - most are not compressed at all.

  7. #52
    Yes, my avatar is stolen anonytmouse's Avatar
    Join Date
    Dec 2002
    Posts
    2,544
    This thread has been resolved via PMs. If anyone is interested, the decode function, which is almost identical to the encode function is reproduced below.
    Code:
    BOOL SpeexDecode(LPCTSTR szInputFile, LPCTSTR szOutputFile)
    {
    	STARTUPINFO         si = { sizeof(STARTUPINFO) };
    	PROCESS_INFORMATION pi = { 0 };
    	TCHAR               szCommandLine[MAX_PATH * 4 + 100];
    	TCHAR               szPath[MAX_PATH];
    	TCHAR*              p;
    
    	/* Get the path of the currently running executable
    	 * which is where we expect speexdec to be located. */
    	GetModuleFileName(NULL, szPath, MAX_PATH);
    	p = FindLastOf(szPath, TEXT('\\')); p[0] = TEXT('\0');
    
    	/* Create command line. */
    	wsprintf(szCommandLine, TEXT("\"%s\\speexdec\" \"%s\" \"%s\""),
    	         szPath, szInputFile, szOutputFile);
    
    	/* Execute command line. */
    	CreateProcess(NULL, szCommandLine, NULL,
    	              NULL, FALSE, 0, NULL, NULL, &si, &pi);
    
    	/* Wait for the command to complete. */
    	WaitForSingleObject(pi.hProcess, INFINITE);
    
    	/* Uncomment this line for debugging, it will show the exact command line used. */
    	// MessageBox(NULL, szCommandLine, NULL, 0);
    
    	/* Cleanup. */
    	CloseHandle(pi.hThread);
    	CloseHandle(pi.hProcess);
    
    	return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. opening an MP3 file for bit access
    By gaza2k1 in forum C Programming
    Replies: 13
    Last Post: 02-24-2008, 09:08 PM
  2. mp3 file renamer
    By Loic in forum C++ Programming
    Replies: 6
    Last Post: 10-17-2007, 12:52 PM
  3. MP3 file searching question
    By panfilero in forum C Programming
    Replies: 4
    Last Post: 11-27-2005, 01:19 PM
  4. Edit mp3 File Names
    By willc0de4food in forum C Programming
    Replies: 20
    Last Post: 04-10-2005, 11:45 PM
  5. wave player or mp3 player using C
    By lliero in forum C Programming
    Replies: 5
    Last Post: 02-27-2002, 11:33 AM