Discussion:
WAV format and graphics
(too old to reply)
wang
2006-01-23 18:58:46 UTC
Permalink
Hi all,
I've tried to read documents on wav format in order to paint the sine
(or zigzag) curve. But the documents I've read tell only where the
sound data are to be found in the file, they do not explain how such
data should be interpreted to paint the curve. Where can such
information
be found? or are there already program codes for performing such
task (I mean painting the sine curve)? Many thanks in advance.

k.w.wang
n***@aol.com
2006-02-02 16:54:04 UTC
Permalink
I will assume your only interested in 16 bit stereo data.

Its stored as positive and negative numbers, with negative numbers
stored as 2's compliment of the number.

see http://en.wikipedia.org/wiki/Two's_complement

These numbers represent the volume level taken at what ever the sample
rate was for the sample.

So to graph them you just plot volumes along a horizontal line.

Take a sample, and erase one of the two stereo sides, save the file and
then take a look at the data, will help you learn to sort out left and
right side.

Load it back into a sample editor.

see http://ccrma.stanford.edu/courses/422/projects/waveFormat/
Erik de Castro Lopo
2006-02-03 18:23:26 UTC
Permalink
Post by wang
Hi all,
I've tried to read documents on wav format in order to paint the sine
(or zigzag) curve. But the documents I've read tell only where the
sound data are to be found in the file, they do not explain how such
data should be interpreted to paint the curve. Where can such
information
be found? or are there already program codes for performing such
task (I mean painting the sine curve)? Many thanks in advance.
libsndfile ( http://www.mega-nerd.com/libsndfile/ ) is a library
for reading and writing sound files.

In the examples/ directory of the source code tarball there
is am example program called make_sine.


Erik
--
+-----------------------------------------------------------+
Erik de Castro Lopo
+-----------------------------------------------------------+
Question #10342: Ruling on a Muslim eating with a kaafir
http://islamqa.com/index.php?ln=eng&ds=qa&lv=browse&QR=10342&dgn=4
Loading...