Page 1 of 1

converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 2:41 am
by Beatport
working on a student project. just curious if anyone knows of any programs that can convert audio files to some sort of numerical data or how i would go about doing this>

thanks!

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 3:00 am
by dinaiz
I might be wrong but I don't think you have to do anything. If you export something in WAV, the codec used shoul be by default PCM (pulse code mudulation) which is just a sequence of raw samples. YOu will probably have to strip the header of the WAV files but that's it.

Have a look here for more info http://ccrma.stanford.edu/courses/422/p ... aveFormat/

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 3:13 am
by Beatport
Interesting. So how would I go about actually seeing the binary or numerical equivalent of that data? I know nothing about computer science - I'm just looking for a way to "translate" numerical data from random audio files into charts.

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 3:31 am
by dinaiz
Double post, sorry

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 3:33 am
by dinaiz
Beatport wrote:Interesting. So how would I go about actually seeing the binary or numerical equivalent of that data? I know nothing about computer science - I'm just looking for a way to "translate" numerical data from random audio files into charts.

Starting after a certain offset, the bytes that you see represent the actual sound. First you have to take in account the way your WAV was encoded :

- mono or stereo ?
- 16bit, 24 bit or 32 bit ?
- 44kHz, or more ?

If you take, for instance, a mono wav file, in 16 bit and 44 kHz, then every 2 bytes (2 bytes = 16 bit) represent one sample ( 1/44.1 second of sound)

Don't forget to strip the header, and take in account the low-endian or big-endian thing. Actually the best thing to do is either to find a software which does it already, or find a mate who is good at computer science. Honestly I don't think it's very difficult, but you do need some computer knowledge.

Good luck !

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 5:11 am
by Tone Deft
AFAIK there is no header. big endian for wav (MSB first), little endian for aiff. (check me on that, wikipedia.)

PCM is encoded as 2s compliment, so the sign bit is first, when set the value is negative and is represented by 1/2^n summation. when the sign bit is 0, the value is positive and just a 2^n summation.

binary vs hex is the same thing, it's just a matter of how many digits you group together.

ASCII doesn't make sense in this case because that's just a (basically) arbitrary way to convert binary into letters, numbers and other human readable info.



what are you really trying to do?

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 5:29 am
by arachnaut
CoolEdit has a file import format that supports ASCII text.
It's now called Audition, but probably still has that feature.

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 2:00 pm
by Beatport
I'm trying to figure out a way to represent the sound data in a color scheme. First I'm just trying to create numerical data from the audio file and see if I can arbitrarily compile a graphics file out of it.

but you guys are all speaking japanese. I can't even figure out how to strip the header much less open the file in an app that will show me binary data.

Hmmm.. I'm actually pretty handy with Max. Maybe I can somehow get a .wav to decode numerically. It doesn't HAVE to be binary - just some type of numerical representation.

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 2:08 pm
by Angstrom
if you want to make nice colours out of audio data then, of course, there are plenty of existing ways of doing this that don't involve you getting your hands dirty.

Why not simply load a wave into an application capable of doing FFT spectrogram analysis and then make use of that bitmap?

I mean, I'm a lazy boy myself - when faced with writing a parser for some established data I can't help but think : has anyone ever done this before, and what is the best one, and can I yoink it?

Image

BTW - there are lots of boxes-and-wires apps you can use to do this yourself if you have a little tech know-how. I use SynthMaker for producing a custom spectrogram in Live.

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 2:14 pm
by Angstrom
Sambean's analysis toolkit in Synthmaker

Image

Re: converting audio files to binary, ascii or hex?

Posted: Fri May 08, 2009 4:23 pm
by Spindrift
Beatport wrote:I'm trying to figure out a way to represent the sound data in a color scheme. First I'm just trying to create numerical data from the audio file and see if I can arbitrarily compile a graphics file out of it.

but you guys are all speaking japanese. I can't even figure out how to strip the header much less open the file in an app that will show me binary data.

Hmmm.. I'm actually pretty handy with Max. Maybe I can somehow get a .wav to decode numerically. It doesn't HAVE to be binary - just some type of numerical representation.
Any file on a computer is numeric.
Open a wav in a hex editor and you can check the value of each bit as binary or byte as hex.
Hex is just a way of representing the bits in a byte using one sign per nibble.
One byte is 8 bits, and each byte has two nibbles with 4 bits each, which then can be represented using 0-F.
It's just a more convenient way or representing the same information instead of having to write out all the 1's and 0's, but it's up to you how you want to view the data.

I guess what you like to do it to process the data using software rather than manually find each sample value. In that case you do not have to worry about reading the file on a bit-by-bit level unless you for some reason like to write everything from scratch. Just use a language that is able read a wav file and create a byte array of sample values from the data. Then you can either use the amplitude values directly or extract frequency information using a Fast Fourier Transform.

Re: converting audio files to binary, ascii or hex?

Posted: Fri Jul 03, 2009 5:00 am
by mathavan.sethu
Converting an audio files to hexadecimal can be done using the software " Hexeditor". by this u can convert any type of data to hex........ but this may harm ur computer as any type of codes can be easily modified....

Re: converting audio files to binary, ascii or hex?

Posted: Fri Jul 03, 2009 6:50 am
by leonard
not sure if the hex values output from hexedit or similar actually represent the amplitude values of the sound file.
i know it's probably no use, but it's quite easy to do this in matlab, and easy to plot the values as well,
max i guess would be your best bet, or something similar...
mathavan.sethu wrote:but this may harm ur computer as any type of codes can be easily modified....
i wouldn't have thought editing he hex value of a sound file would be harmful to your computer?
just screw up the sound file wouldn't it?