On Fri, Aug 08, 2003 at 09:22:47AM +0100, Craig Tinson wrote: > Guys... > > I've had an idea for a "play project" I can work on at home in my spare > time.. but before I start on it I need a few ideas.. > > Can anyone come up with a theory on how to "convert an mp3 into a > number"? I know that sounds weird so I'll explain what I mean... > > Imagine converting an mp3 into a wav and loading it into a wav editor.. > you will see a waveform.. there must be a mathematical way of converting > that waveform into a unique number that will represent that waveform.. > the number would be huge to hold all the information for the waveform... > > When I say "number" I don't mean as in integer, long etc.. I mean as in > a huge set of individual integers.. > > Hope that all makes sense.. anyone any ideas on how this could be done?
A wav file is already a huge list of numbers. CD quality audio in wav format is about 44100 numbers per second (these are called samples), times 2 because it is stereo and has two waveforms one for right and one for left, (these are called channels) and each number is 16 bits in size (0 to 65535) this is the size of each sample. The waveform you see in an editor is just a line joining these numbers/samples. If you open up a wav file in a text editor you won't be able to see this because the numbers are stored in binary. I also believe that there is some information about the file stored either at the beginning or the end of the wav file. It seems that what you want to do is write a filter that will take a wav file and output the numbers in the wav file as human readable numbers. Rather than writing one I recommend you take a look at a library for dealing with sound file formats. Possibly a program like play or sox could also do. Hope that helps, Bijan
pgp00000.pgp
Description: PGP signature