🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.lang.basic
Article #744

Re: How is a .WAV header ?

#744
From: Qurt
Date: Tue, 09 Sep 1997 00:00
146 lines
10661 bytes
This is a multi-part message in MIME format.
--------------D44A3BD2B097C4063E388D35
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Here's a text file explaining the WAV format... this is an except from
the PCGPE
(PC game programmer's encyclopedia), which is available for download off
the web.

Hope it help...
-Qurt

Thunder wrote:

>  I want to know where (in bytes) are located the file information &
> specifications ...
> I'd like to be able to read:
>     - The number of sampling bits (8 bits or 16 bits ? )
>     - The channels (stereo or mono)
>     - The sample rate
>     - The total length of the samples
>     - And all that would be available in the WAVE header



--------------D44A3BD2B097C4063E388D35
Content-Type: text/plain; charset=iso-8859-1; name="Wav.txt"
Content-Transfer-Encoding: 8bit
Content-Disposition: inline; filename="Wav.txt"


          ������������������������������������������������Ŀ
          � The Microsoft Multimedia WAV Sound File Format �
          ��������������������������������������������������

                 Written for the PC-GPE by Mark Feldman
            e-mail address : u914097@student.canberra.edu.au
                             myndale@cairo.anu.edu.au

             �������������������������������������������Ŀ
             �      THIS FILE MAY NOT BE DISTRIBUTED     �
             � SEPARATE TO THE ENTIRE PC-GPE COLLECTION. �
             ���������������������������������������������


�����������������������������������������������������������������������������
� Disclaimer �
��������������

I assume no responsibility whatsoever for any effect that this file, the
information contained therein or the use thereof has on you, your sanity,
computer, spouse, children, pets or anything else related to you or your
existance. No warranty is provided nor implied with this information.

�����������������������������������������������������������������������������
� The RIFF File Format �
������������������������

WAV files use the RIFF file structure. The RIFF format was designed
for multi-media purposes. A RIFF files consists of a number of "chunks":

  ������������������������������������������������������������������������Ŀ
  � Byte              Length                                               �
  � Offset   Name   (in bytes)    Description                              �
  ������������������������������������������������������������������������Ĵ
  � 00h      rID        4h        Contains the characters "RIFF"           �
  � 04h      rLen       4h        The length of the data in the next chunk �
  � 08h      rData     rLen       The data chunk                           �
  ��������������������������������������������������������������������������


�����������������������������������������������������������������������������
� The WAVE Form Definition �
����������������������������

The rData chunk in a WAV file is split up into several further chunks:

 �������������������������������������������������������������������������Ŀ
 � rData                                                                   �
 � Byte              Length                                                �
 � Offset   Name   (in bytes)    Description                               �
 �������������������������������������������������������������������������Ĵ
 � 00h      wID        4h        Contains the characters "WAVE"            �
 � 04h      Format    14h        Contains data which specifies the format  �
 �          Chunk                  of the Data in the Data Chunk           �
 � 18h      WAVE Data  ?         Contains the WAV audio data               �
 �          Chunk                                                          �
 ���������������������������������������������������������������������������



�����������������������������������������������������������������������������
� The Format Chunk �
��������������������

The Format Chunk is split up into these fields:

�������������������������������������������������������������������������Ŀ
� Format                                                                  �
� Chunk                  Length                                           �
� Offset  Name         (in bytes)   Description                           �
�������������������������������������������������������������������������Ĵ
� 00h     fId               4       Contains the characters "fmt"         �
� 04h     fLen              4       Length of data in the format chunk    �
� 08h     wFormatTag        2       *                                     �
� 0Ah     nChannels         2       Number of channels, 1=mono, 2=stereo  �
� 0Ch     nSamplesPerSec    2       Playback frequency                    �
� 0Eh     nAvgBytesPerSec   2       **                                    �
� 10h     nBlockAlign       2       ***                                   �
� 12h     FormatSpecific    2       Format specific data area             �
���������������������������������������������������������������������������

* The wFormatTag specifies the wave format, eg 1 = Pulse Code Modulation
  (or in plain english, regular 8 bit sampled uncompressed sound)

** Indicates the average number of bytes a second the data should be
   transferred at = nChannels * nSamplesPerSec * (nBitsPerSample / 8)

*** Indicates the block alignment of the data in the data chunk. Software
    needs to process a multiplt of nBlockAlign at a time.
    nBlockAlign = nChannels * (nBitsPerSample / 8)


�����������������������������������������������������������������������������
� The Data Chunk �
������������������

The Data Chunk is split up into these fields:

�������������������������������������������������������������������������Ŀ
�  Data                                                                   �
� Chunk                  Length                                           �
� Offset  Name         (in bytes)   Description                           �
�������������������������������������������������������������������������Ĵ
� 00h     dId              4        Contains the characters "data"        �
� 02h     dLen             4        Length of data in the dData field     �
� 00h     dData            dLen     The actual waveform data              �
���������������������������������������������������������������������������

In mono 8-bit files each byte represents one sample. In stereo 8-bit files
two bytes are stored for each sample, the first byte is the left channel
value, the next is the right channel value.

--------------D44A3BD2B097C4063E388D35--
Technical Details
Message-ID: <3415FB94.2176218D@writeme.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <5uv3ud$skq$2@newsfeeds.grolier.fr>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII
X-Google-Thread: f7646,4c981daff51c860d
X-Google-Attributes: gidf7646,public
X-Google-Thread: 10ab99,4c981daff51c860d
X-Google-Attributes: gid10ab99,public
X-Google-Thread: f78f1,4c981daff51c860d
X-Google-Attributes: gidf78f1,public
From: Qurt <cobain@writeme.com>
Subject: Re: How is a .WAV header ?
Date: 1997/09/09
Message-ID: <3415FB94.2176218D@writeme.com>
X-Deja-AN: 271258547
References: <5uv3ud$skq$2@newsfeeds.grolier.fr>
To: Thunder <BrunoM@mail.dotcom.fr>
Organization: Puerto Rico Telephone Company
Newsgroups: alt.lang.basic,fr.comp.lang.basic,microsoft.public.basic.dos