Audio File to Hexadecimal for storing in SD or EEPROM

Hello,

I'm looking for a free program that converts an audio file to hex file can anyone lead me to one?

An audio file is already in "hex"... sort of.... It's actually binary so it can be easily read as hex or written from hex. Eeverything "inside" the computer (or microcontroller) is binary.

In C or C++ the format gets converted during input/output (usually to decimal or hex). So for example, you can save a variable in decimal, and read it back in hex if you wish. Or, if the value happens to represent an ASCII character, you can also print/display the ASCII character (even if the value isn't supposed to be an ASCII character)

You can think of any file as a series of bytes, and you can read/write those bytes in hex, decimal, etc. For an uncompressed audio file, you have to know the structure and byte order. For example, you can look-up the WAV spec to see how the bytes in a 16-bit stereo file are stored.

Compressed formats are more complicated because the data has to to be encoded, and then when you play the file it has to be decoded back to a series of PCM sample values to be sent to your digital-to-analog converter.

It's not clear what you mean when you say,

MikeLemon:
... converts an audio file to hex file ...

I think that when you say, "hex," you mean that you want binary data, rather than an ASCII file of hexadecimal characters. I think that you want a program that takes some kind of audio file file as input, and produces a file of binary data that represents the audio signal, with no headers or other information.

"Audacity" is an application that fits those requirements: it's available for Windows, Linux and Mac; it'll convert at least some audio files to binary; and it's free. Here's how to do the conversion:

  • Open the audio file
  • File -> Export ...
  • In the window that pops up, select the file format as "Other uncompressed files"
  • Select "Options"
  • Select the "Header" as "RAW (header-less)"
  • Pick the output encoding that you want
  • Give the file a name, and save it

I tested this using Audacity 2.0.5 under Ubuntu 14.04. I selected signed 16-bit encoding, and it delivered a file that looked right. Output was little-endian. [Edit: add this sentence] The sample rate looked to be the same as that of the original file, in this case 44100/s, but of course that information isn't contained in the RAW audio file. I tried it with a .wav file as input. It looks like Audacity will deliver a RAW stream for any type of file that it can read, including .mp3, .flac, and .ogg, but I haven't tried it with those.

You can get Audacity here: Audacity download | SourceForge.net. The curernt version appears to be 2.0.6. I got my copy from the default Ubuntu repository.

No, I want to be able to open that in notepad++ and see the content in HEXADECIMAL.

OK. I know of no program that converts audio files to ASCII hex. I can't see a purpose for one, either.

Maybe you just want a hex editor.

[u]XVI32[/u] is a hex editor. It will show you the hexadecimal values of the bytes in any file. It will also show you ASCII characters for any byte values that can be converted to ASCII. This is helpful if you are looking at a WAV header. (The hex editor doesn't know if the byte is supposed to represent characters, because it doesn't parse the file format. It just shows a character for any value that is in the ASCII range.)

And of course, you can edit the hex values. But, I'm not sure how this is going to help you....

HxD is another hex editor that you can export the file as various types including C# & C but you would need to ensure the audio file is raw uncompressed else you will also be exporting the file header.

Wikipedia lists features, cost, and operating systems for a veritable plethora of hex editors: Comparison of hex editors - Wikipedia.

DVDdoug:
I'm not sure how this is going to help you...

The OP is silent about his purpose. Having guessed wrong once in this thread already, a wiser man than I would refrain from further conjecture. My guess is that he wants to look at audio file headers - like maybe wav headers - to figure out how to write code that interprets and writes them.

Riva:
HxD is another hex editor that you can export the file as various types including C# & C but you would need to ensure the audio file is raw uncompressed else you will also be exporting the file header.

Thanks that's what I was looking for!