Translating between .WAV file and a long list of numbers

Does anybody provide a software utility that transforms between the .wav audio file format and a text format that is just a long list of the numbers, maybe separated with spaces or commas or CRLF’s?

I don’t mean a program that acts like a stenographer, interpreting recorded speech into words and wordprocessing them. Anybody who googles “wav to text” is going to find a million of these, and I will be forced to quote my OP to them with a patient look on my face. Likewise “text to wav” and the speech synthesizer programs. What I want has nothing to do with speech.

I mean something that you could use to read numeric values, like you could read them off an oscilloscope screen. Or something you could use to translate tables you generated with mathematical equations into sounds you could hear.

I’ve found descriptions of the .wav file format. For a good laugh read
www.coe.uncc.edu/~danderse/www/wav-format.html
and see what a head-bashing, teeth-gnashing, eye-stabbing night I am in for if I do it for my own sorry self. It’s enough to make one pine for tax preparation season.

Is this something important? I could probably hack a quick program up if you need it.

You need SOX. You can get it here:
http://sox.sourceforge.net/

Down towards the bottom is a link to a Windows CLI binary. There are also version for several flavors of Unix and the source code.

SOX translates between lots of strange formats, including textual RAW, which is what you want. It can also translate some much simpler binary formats into .wav files, so you might want to look it over before you write your software to generate files. Depending on what language you are using, you may be able to use the SOX libraries in your own program and generate .wav files directly from your program. Watch out for the licensing, though. SOX is GPL, so you’ll need to be careful if you plan to sell or distribute your program.

Warning: SOX is strictly command line operated.

I’ve written at least one wave parser before and was sufficiently bored last night that I put together something that might be what you’re looking for at http://www.thepatsite.com/misc_files/wav2txt.c . I’ve only tested it with a single 16-bit mono file, so I can’t guarantee it works, and it makes assumptions about your hardware (and just about everything else). But if you have a C compiler handy, you can compile it and run it as:


wav2txt inputfile.wav

And it’ll output a space-separated list of values for each channel (in theory :frowning: ).

(Also, I think you found the very worst wave format reference on the planet. http://www.sonicspot.com/guide/wavefiles.html is much better.)

Mort Furd:
I needed SOX. Damn, that’s fine. What a useful program! It works!

Anybody who wants to be able to translate and mess with sound files should try it.

Garnet and praxim - wow, thanks, guys! You’re kind!

This is the kind of thing that makes SDMB great.