Archivos wav

Hola lgalvan:
La duda que tengo es como puedo graficar las ondas de un archivo WAV, pero sin controles activex.
Por favor ayudame a resolver este problema.
Gracias.
[email protected]
Respuesta
1
Espero pueda ayudarte, tengo una especificacion pero en ingles espero te sirva:
Waveform Audio File Format (WAVE)
This section describes the Waveform format, which is
used to represent digitized sound.RIFF
forms;WAVEWaveform files;WAVE formatFile
formats;Waveform Audio (WAVE)
The WAVE form is defined as follows. Programs must
expect (and ignore) any unknown chunks encountered, as
with all RIFF forms. However, <fmt-ck> must always
occur before <wave-data>, and both of these chunks are
mandatory in a WAVE file.
<WAVE-form> Ý
RIFF( 'WAVE'
<fmt-ck> // Format
[<fact-ck>] // Fact chunk
[<cue-ck>] // Cue points
[<playlist-ck>] // Playlist
[<assoc-data-list>] //
Associated data list
<wave-data> ) // Wave data
The WAVE chunks are described in the following
sections.
WAVE Format Chunk
The WAVE format chunk <fmt-ck> specifies the format of
the <wave-data>. The <fmt-ck> is defined as follows:
<fmt-ck> Ý fmt( <common-fields>
<Format-specific-fields> )
<Common-fields> Ý
struct
{
WORD wFormatTag; // Format
category
WORD wChannels; // Number of
channels
DWORD dwSamplesPerSec; //
Sampling rate
DWORD dwAvgBytesPerSec; // For
buffer estimation
WORD wBlockAlign; // Data block size
}
The fields in the <common-fields> chunk are as follows:
Field Description
WFormatTag A number indicating the WAVE format
Category of the file. The content of
The <format-specific-fields> portion
Of the fmt chunk, and the
Interpretation of the waveform data,
depend on this value.
You must register any new WAVE format
Categories. See Registering
Multimedia Formats in Chapter 1,
Overview of Multimedia
Specifications, for information on
Registering WAVE format categories.
Wave Format Categories, following
this section, lists the currently
Defined WAVE format categories.
WChannels The number of channels represented in
the waveform data, such as 1 for mono
or 2 for stereo.
DwSamplesPerSe The sampling rate (in samples per
c second) at which each channel should
Be played.
DwAvgBytesPerS The average number of bytes per second
ec at which the waveform data should be
Transferred. Playback software can
estimate the buffer size using this
value.
wBlockAlign The block alignment (in bytes) of the
waveform data. Playback software needs
to process a multiple of wBlockAlign
bytes of data at a time, so the value
of wBlockAlign can be used for buffer
alignment.
The <format-specific-fields> consists of zero or more
bytes of parameters. Which parameters occur depends on
the WAVE format category-see the following section for
details. Playback software should be written to allow
for (and ignore) any unknown <format-specific-fields>
parameters that occur at the end of this field.Samples,
setting bits per sample
WAVE Format Categories
The format category of a WAVE file is specified by the
value of the wFormatTag field of the fmt chunk. The
representation of data in <wave-data>, and the content
of the <format-specific-fields> of the fmt chunk,
depend on the format category.Waveform files;format
categories
The currently defined open non-proprietary WAVE format
categories are as follows:
wFormatTag Value Format Category
WAVE_FORMAT_PCM (0x0001) Microsoft Pulse Code
Modulation (PCM) format
The following are the registered proprietary WAVE
format categories:
wFormatTag Value Format Category
IBM_FORMAT_MULAW IBM mu-law format
(0x0101)
IBM_FORMAT_ALAW (0x0102) IBM a-law format
IBM_FORMAT_ADPCM IBM AVC Adaptive
(0x0103) Differential Pulse Code
Modulation format
The following sections describe the Microsoft
WAVE_FORMAT_PCM format.
Pulse Code Modulation (PCM) Format
If the wFormatTag field of the <fmt-ck> is set to
WAVE_FORMAT_PCM, then the waveform data consists of
samples represented in pulse code modulation (PCM)
format. For PCM waveform data, the <format-specific-
fields> is defined as follows:
<PCM-format-specific> Ý
struct
{
WORD wBitsPerSample; // Sample size
}
The wBitsPerSample field specifies the number of bits
of data used to represent each sample of each channel.
If there are multiple channels, the sample size is the
same for each channel.
For PCM data, the wAvgBytesPerSec field of the fmt
chunk should be equal to the following formula rounded
up to the next whole number:
The wBlockAlign field should be equal to the following
formula, rounded to the next whole number:Data
blocks;aligning waveform
Data Packing for PCM WAVE Files
In a single-channel WAVE file, samples are stored
consecutively. For stereo WAVE files, channel 0
represents the left channel, and channel 1 represents
the right channel. The speaker position mapping for
more than two channels is currently undefined. In
multiple-channel WAVE files, samples are interleaved.
The following diagrams show the data packing for a 8-
Bit mono and stereo WAVE files:
Sample 1 Sample 2 Sample 3 Sample 4
Channel 0 Channel 0 Channel 0 Channel 0
Data Packing for 8-Bit Mono PCM
Sample 1 Sample 2
Channel 0 Channel 1 Channel 0 Channel 0
(left) (right) (left) (right)
Data Packing for 8-Bit Stereo PCM
The following diagrams show the data packing for 16-bit
mono and stereo WAVE files:
Sample 1 Sample 2
Channel 0 Channel 0 Channel 0 Channel 0
low-order high-order low-order high-order
byte byte byte byte
Data Packing for 16-Bit Mono PCM
Sample 1
Channel 0 Channel 0 Channel 1 Channel 1
(left) (left) (right) (right)
Low-order high-order low-order high-order
byte byte byte byte
Data Packing for 16-Bit Stereo PCM
Data Format of the Samples
Each sample is contained in an integer i. The size of i
is the smallest number of bytes required to contain the
specified sample size. The least significant byte is
stored first. The bits that represent the sample
amplitude are stored in the most significant bits of i,
and the remaining bits are set to zero.
For example, if the sample size (recorded in
nBitsPerSample) is 12 bits, then each sample is stored
in a two-byte integer. The least significant four bits
of the first (least significant) byte is set to
zero.Amplitude, setting waveform
The data format and maximum and minimums values for PCM
waveform samples of various sizes are as follows:
Sample Size Data Format Maximum Value Minimum Value
One to Unsigned 255 (0xFF) 0
eight bits integer
Nine or Signed Largest Most negative
more bits integer i positive value of i
value of i
For example, the maximum, minimum, and midpoint values
for 8-bit and 16-bit PCM waveform data are as follows:
Format Maximum Minimum Value Midpoint
Value Value
8-bit PCM 255 (0xFF) 0 128 (0x80)
16-bit PCM 32767 -32768 (- 0
(0x7FFF) 0x8000)
Examples of PCM WAVE Files
Example of a PCM WAVE file with 11.025 kHz sampling
rate, mono, 8 bits per sample:
RIFF( 'WAVE' fmt(1, 1, 11025, 11025, 1, 8)
Data( <wave-data> ) )
Example of a PCM WAVE file with 22.05 kHz sampling
rate, stereo, 8 bits per sample:
RIFF( 'WAVE' fmt(1, 2, 22050, 44100, 2, 8)
Data( <wave-data> ) )
Example of a PCM WAVE file with 44.1 kHz sampling rate,
mono, 20 bits per sample:
RIFF( 'WAVE' INFO(INAM("O Canada"Z))
Fmt(1, 1, 44100, 132300, 3, 20)
Data( <wave-data> ) )
Storage of WAVE Data
The <wave-data> contains the waveform data. It is
defined as follows:
<wave-data> Ý { <data-ck> | <data-list> }
<data-ck> Ý data( <wave-data> )
<wave-list> Ý LIST( 'wavl' { <data-ck> |
// Wave samples
<silence-ck> }... ) //
Silence
<silence-ck> Ý slnt( <dwSamples:DWORD> )
// Count of
// silent
samples
Note: The slnt chunk represents silence, not
necessarily a repeated zero volume or baseline sample.
In 16-bit PCM data, if the last sample value played
before the silence section is a 10000, then if data is
still output to the D to A converter, it must maintain
the 10000 value. If a zero value is used, a click may
be heard at the start and end of the silence section.
If play begins at a silence section, then a zero value
might be used since no other information is available.
A click might be created if the data following the
silent section starts with a nonzero value.

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas