Delphi Pages Forums  

Go Back   Delphi Pages Forums > Delphi Forum > General

Lost Password?

Reply
 
Thread Tools Display Modes
  #1  
Old 03-21-2001, 12:39 PM
mbranco mbranco is offline
Senior Member
 
Join Date: Jan 2001
Posts: 164
Default How could i convert a Mp3 file to Wave and wave to mp3

How could i convert a file from
CD Audio Track to MP3
Wave To Mp3
MP3 to Cd Audio Track
MP3 to Wave

Thank's in advance

Marco Branco
Reply With Quote
  #2  
Old 03-21-2001, 12:47 PM
Tavares Tavares is offline
Senior Member
 
Join Date: Feb 2001
Posts: 1,318
Default RE: How could i convert a Mp3 file to Wave and wave to mp3

How To Convert MP3 Files To WAV Files

by Simon Lau - S.Lau@cs.ucl.ac.uk

There may be some times when you need to convert an MP3 file back to bog standard PCM wave audio format, like, for example in a sound editing program. If you want to do this, then all you have to do is use the Xaudio SDK. By the way, I said that the Xaudio SDK was free. Well, it's not.

By default, when you tell the XAudioPlayer to play, it plays the music through your soundcard. However, instead of using the standard soundcard output module, you can instruct the player to use a different output module, like the one that outputs to a file.

To set the output module to the file writer thing, you do something like this:

XaudioPlayer.SetOutputModule(0);

0, in this case is the ID for the "Output To File" output module.

Usually the default OutputModule ID is -1 or value XA_DECODER_OUTPUT_AUTOSELECT, which means that the player automatically sets the output module to whatever it thinks best.

Ok, the next thing to do is to say what file you want to write to. To do this, you tell the output module what file to open. Like this:

XaudioPlayer.OutputOpen('e:\stuff.wav');

This will output the raw PCM data to a file called "e:\stuff.wav". However if you really want a proper WAVE file, with a wave header section at the front you need tospecify it, like this: 'wav:e:\stuff.wav'

Also, if you don't want the decoder to take all your processing time as it writes your file, you should set its priority level to 2, instead of the default 4:

XAudioPlayer.Priority := 2;

Now, all you have to do is open the input file, like so:

if OpenFileDialog.Execute then
begin
XaudioPlayer.InputOpen(OpenFileDialog.FileName);
end

The player should start playing straight away. However instead of playing through your soundcard, it plays to your harddrive. If you have the equalizer switched on, well this will effect the saved file. In fact, if you have some sort of trackbar to set the position of the music, you could "remix" the music as it gets saved to the file, though it probably will not sound too good. Trust me, I've tried.

So yet again, we've reached the end of my quick guide to using the X-audio sdk. I've written a sample program to demonstrate the mp3 decoding thing, so click here to get it

Taken from http://www.undu.com/Articles/000117a.html

Regards,
Eduardo Tavares
www.tavareswebsite.cjb.net
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On

Forum Jump


All times are GMT. The time now is 04:57 AM.


Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.