INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Creating a playable WAV file from data or equation input

Creating a playable WAV file from data or equation input

(OP)
I'm looking for a means to create a playable *.WAV file from either some sort of data list or equation. I'd like to combine and create a data list of combined sine waves together (creating a sawtooth, triangular, or sauare waves) then listen to the resulting noise from the data list (using perhaps EXCEL, TXT, or MATLAB).

Does anyone have a recommendation of how to do this?

RE: Creating a playable WAV file from data or equation input

Matlab script sound(y,Fs,nBits)?

RE: Creating a playable WAV file from data or equation input

What Greg said, except the file is hex/binary, not text. Wikipedia has a lot of info on the structure of .wav files.

RE: Creating a playable WAV file from data or equation input

If you are a competent (possibly even adventurous) C programmer, the Microsoft WAVE format is published. Here is someone's fairly well annotated copy of it:

https://ccrma.stanford.edu/courses/422/projects/WaveFormat/

Be prepared to think in terms of bits and bytes though, possibly even endianness (although not probably an issue unless you want to write AIFF files too). You might want to hex dump a small working one to see what's inside. It'll help you to understand the format.

- Steve

RE: Creating a playable WAV file from data or equation input

I apologise, wav either used to be ascii format or I used to be a lot cleverer than I am now, or both, either way I wrote a qbasic program to do exactly what I said.

Cheers

Greg Locock


New here? Try reading these, they might help FAQ731-376: Eng-Tips.com Forum Policies http://eng-tips.com/market.cfm?

RE: Creating a playable WAV file from data or equation input

Greg,

wav (and other binary files) still look like ASCII when pulled up in Notepad, or you can read them in bytes with a program, just like ASCII.

If you know where the wav file header ends, you can copy and paste with Notepad or however you want. But don't use Word - it'll insert formatting in normal mode.

Best to you,

Goober Dave

Haven't see the forum policies? Do so now: Forum Policies

RE: Creating a playable WAV file from data or equation input

DR - you mean the header shows up in ASCII? The data is in binary, though, at least in examples I could find quickly (wikipedia has several, and Steve's excellent link shows it that way too). I do recall some kind of sound file that had human-readable (decimal number) inputs...but I too may be suffering from any number of maladies, including Friday-itis and LBL (Low Beer Levels).

RE: Creating a playable WAV file from data or equation input

btrueblood,

Try opening up a wav file in a text-only editor of your choice (it turns out Notepad puts extra stuff in there when saving nowadays). Even though you see jibberish, you can copy and paste that jibberish into another file without disturbing it, as long as you know where you are. Agreed, it's tough to interpret.

I used to have a disk patcher that would show you the hex for each byte and the ASCII to the right. It was even better, but the old thing has disappeared... If I find it, I'll post it here -- I do remember it was freeware.

Best to you,

Goober Dave

Haven't see the forum policies? Do so now: Forum Policies

RE: Creating a playable WAV file from data or equation input

The problem with some of these file formats is that while *most* tools/players will like them, a stray bit here and there may make other tools hate them. A two goal problem: #1, make a sound, whatever from your PC's default WAV player; #2 make the code robust and conforming to their standard in every way.

- Steve

RE: Creating a playable WAV file from data or equation input

<soapbox>
Forget Windows, forget the curse of the double-click that tries to guess what you want. A standard (non-interpretive) text or binary editor works wonders.
n the real World, it's emacs or vi.
</soapbox>

Most "interesting" stuff from any binary file can be found using "strings".

- Steve

RE: Creating a playable WAV file from data or equation input

I feel like we've lost the OP and are now talking about my job.

- Steve

RE: Creating a playable WAV file from data or equation input

"Even though you see jibberish"

Yes, that is what binary/hex files look like in a text editor.

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close