converting audio files to binary, ascii or hex?

Discussion of music production, audio, equipment and any related topics, either with or without Ableton Live
Post Reply
Beatport
Posts: 176
Joined: Sat Dec 30, 2006 3:29 pm

converting audio files to binary, ascii or hex?

Post by Beatport » Fri May 08, 2009 2:41 am

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!

dinaiz
Posts: 414
Joined: Thu Jul 24, 2008 2:50 pm
Location: France
Contact:

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

Post by dinaiz » Fri May 08, 2009 3:00 am

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/

Beatport
Posts: 176
Joined: Sat Dec 30, 2006 3:29 pm

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

Post by Beatport » Fri May 08, 2009 3:13 am

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.

dinaiz
Posts: 414
Joined: Thu Jul 24, 2008 2:50 pm
Location: France
Contact:

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

Post by dinaiz » Fri May 08, 2009 3:31 am

Double post, sorry
Last edited by dinaiz on Fri May 08, 2009 3:34 am, edited 1 time in total.

dinaiz
Posts: 414
Joined: Thu Jul 24, 2008 2:50 pm
Location: France
Contact:

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

Post by dinaiz » Fri May 08, 2009 3:33 am

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 !

Tone Deft
Posts: 24154
Joined: Mon Oct 02, 2006 5:19 pm

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

Post by Tone Deft » Fri May 08, 2009 5:11 am

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?
In my life
Why do I smile
At people who I'd much rather kick in the eye?
-Moz

arachnaut
Posts: 951
Joined: Mon Aug 21, 2006 9:58 pm
Location: Sunnyvale, CA USA
Contact:

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

Post by arachnaut » Fri May 08, 2009 5:29 am

CoolEdit has a file import format that supports ASCII text.
It's now called Audition, but probably still has that feature.

Beatport
Posts: 176
Joined: Sat Dec 30, 2006 3:29 pm

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

Post by Beatport » Fri May 08, 2009 2:00 pm

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.

Angstrom
Posts: 14754
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

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

Post by Angstrom » Fri May 08, 2009 2:08 pm

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.

Angstrom
Posts: 14754
Joined: Mon Oct 04, 2004 2:22 pm
Contact:

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

Post by Angstrom » Fri May 08, 2009 2:14 pm

Sambean's analysis toolkit in Synthmaker

Image

Spindrift
Posts: 54
Joined: Sat Jun 09, 2007 11:24 am

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

Post by Spindrift » Fri May 08, 2009 4:23 pm

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.

mathavan.sethu
Posts: 1
Joined: Fri Jul 03, 2009 4:57 am

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

Post by mathavan.sethu » Fri Jul 03, 2009 5:00 am

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

leonard
Posts: 893
Joined: Wed Oct 12, 2005 4:52 am
Location: ? ?

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

Post by leonard » Fri Jul 03, 2009 6:50 am

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

Post Reply