new wave types
--------------------------------------------------------------------------------
the necessary type, structure and constant defintions are in mmreg.h.
all newly defined wave types must contain both a fact chunk and an extended wave format description within the 'fmt' chunk. riff wave files of type wave_format_pcm need not have the extra chunk nor the extended wave format description.
fact chunk
this chunk stores file dependent information about the contents of the wave file. it currently specifies the length of the file in samples.
waveformatex
the extended wave format structure is used to defined all non-pcm format wave data, and is described as follows in the include file mmreg.h:
/* general extended waveform format structure */
/* use this for all non pcm formats */
/* (information common to all formats) */
typedef struct waveformat_extended_tag {
word wformattag; /* format type */
word nchannels; /* number of channels (i.e. mono, stereo...) */
dword nsamplespersec; /* sample rate */
dword navgbytespersec; /* for buffer estimation */
word nblockalign; /* block size of data */
word wbitspersample; /* number of bits per sample of mono data */
word cbsize; /* the count in bytes of the extra size */} waveformatex;
wformattag defines the type of wave file.
nchannels number of channels in the wave, 1 for mono, 2 for stereo
nsamplespersec frequency of the sample rate of the wave file. this should be 11025, 22050, or 44100. other sample rates are allowed, but not encouraged. this rate is also used by the sample size entry in the fact chunk to determine the length in time of the data.
navgbytespersec average data rate.
playback software can estimate the buffer size using the <navgbytespersec> value.
nblockalign the block alignment (in bytes) of the data in <data-ck>.
playback software needs to process a multiple of <nblockalign> bytes of data at a time, so that the value of <nblockalign> can be used for buffer alignment.
wbitspersample this is the number of bits per sample per channel data. each channel is assumed to have the same sample resolution. if this field is not needed, then it should be set to zero.img
cbsize the size in bytes of the extra information in the wave format header not including the size of the waveformatex structure.. as an example, in the ima adpcm format cbsize is calculated as sizeof(imaadpcmwaveformat) - sizeof(waveformatex) which yeilds two.
defined wformattags
expr1 wave form registration no - hex expr2
#define wave_format_g723_adpcm 0x0014 /* antex electronics corporation */
#define wave_format_antex_adpcme 0x0033 /* antex electronics corporation */
#define wave_format_g721_adpcm 0x0040 /* antex electronics corporation */
#define wave_format_aptx 0x0025 /* audio processing technology */
#define wave_format_audiofile_af36 0x0024 /* audiofile, inc. */
#define wave_format_audiofile_af10 0x0026 /* audiofile, inc. */
#define wave_format_control_res_vqlpc 0x0034 /* control resources limited */
#define wave_format_control_res_cr10 0x0037 /* control resources limited */
#define wave_format_creative_adpcm 0x0200 /* creative labs, inc */
#define wave_format_dolby_ac2 0x0030 /* dolby laboratories */
#define wave_format_dspgroup_truespeech 0x0022 /* dsp group, inc */
#define wave_format_digistd 0x0015 /* dsp solutions, inc. */
#define wave_format_digifix 0x0016 /* dsp solutions, inc. */
#define wave_format_digireal 0x0035 /* dsp solutions, inc. */
#define wave_format_digiadpcm 0x0036 /* dsp solutions, inc. */
#define wave_format_echosc1 0x0023 /* echo speech corporation */
#define wave_format_fm_towns_snd 0x0300 /* fujitsu corp. */
#define wave_format_ibm_cvsd 0x0005 /* ibm corporation */
#define wave_format_oligsm 0x1000 /* ing c. olivetti & c., s.p.a. */
#define wave_format_oliadpcm 0x1001 /* ing c. olivetti & c., s.p.a. */
#define wave_format_olicelp 0x1002 /* ing c. olivetti & c., s.p.a. */
#define wave_format_olisbc 0x1003 /* ing c. olivetti & c., s.p.a. */
#define wave_format_oliopr 0x1004 /* ing c. olivetti & c., s.p.a. */
#define wave_format_ima_adpcm (wave_form_dvi_adpcm) /* intel corporation */
#define wave_format_dvi_adpcm 0x0011 /* intel corporation */
#define wave_format_unknown 0x0000 /* microsoft corporation */
#define wave_format_pcm 0x0001 /* microsoft corporation */
#define wave_format_adpcm 0x0002 /* microsoft corporation */
#define wave_format_alaw 0x0006 /* microsoft corporation */
#define wave_format_mulaw 0x0007 /* microsoft corporation */
#define wave_format_gsm610 0x0031 /* microsoft corporation */
#define wave_format_mpeg 0x0050 /* microsoft corporation */
#define wave_format_nms_vbxadpcm 0x0038 /* natural microsystems */
#define wave_format_oki_adpcm 0x0010 /* oki */
#define wave_format_sierra_adpcm 0x0013 /* sierra semiconductor corp */
#define wave_format_sonarc 0x0021 /* speech compression */
#define wave_format_mediaspace_adpcm 0x0012 /* videologic */
#define wave_format_yamaha_adpcm 0x0020 /* yamaha corporation of america */
unknown wave type
added: 05/01/92
author: microsoft
fact chunk
this chunk is required for all wave formats other than wave_format_pcm. it stores file dependent information about the contents of the wave data. it currently specifies the time length of the data in samples.
wave format header
changed as of september 5, 1993: this wave format will not be defined. for development purposes, do not use 0x0000. instead, use 0xffff until an id has been obtained.
# define wave_format_unknown (0x0000)
wformattag this must be set to wave_format_unknown.
nchannels number of channels in the wave.(1 for mono)
nsamplespersec frequency the of the sample rate of wave file.
navgbytespersec average data rate.
playback software can estimate the buffer size using the <navgbytespersec> value.
nblockalign block alignment of the data.
playback software needs to process a multiple of <nblockalign> bytes of data at a time, so that the value of <nblockalign> can be used for buffer alignment.
wbitspersample this is the number of bits per sample of data.
cbsize the size in bytes of the extra information in the extended wave 'fmt' header.
microsoft adpcm
added 05/01/92
author: microsoft
fact chunk
this chunk is required for all wave formats other than wave_format_pcm. it stores file dependent information about the contents of the wave data. it currently specifies the time length of the data in samples.
wave format header
# define wave_format_adpcm (0x0002)
typedef struct adpcmcoef_tag {
int icoef1;
int icoef2;
} adpcmcoefset;
typedef struct adpcmwaveformat_tag {
waveformatex wfxx;
word wsamplesperblock;
word wnumcoef;
adpcmcoefset acoeff[wnumcoef];
} adpcmwaveformat;
wformattag this must be set to wave_format_adpcm.
nchannels number of channels in the wave, 1 for mono, 2 for stereo.
nsamplespersec frequency of the sample rate of the wave file. this should be 11025, 22050, or 44100. other sample rates are allowed, but not encouraged.
navgbytespersec average data rate. ((nsamplespersec / nsamplesperblock) * nblockalign).
playback software can estimate the buffer size using the value.
nblockalign the block alignment (in bytes) of the data in .
nsamplespersec x channels nblockalign
8k 256
11k 256
22k 512
44k 1024
playback software needs to process a multiple of <nblockalign> bytes of data at a time, so that the value of <nblockalign> can be used for buffer alignment.
wbitspersample this is the number of bits per sample of adpcm. currently only 4 bits per sample is defined. other values are reserved.
cbsize the size in bytes of the extended information after the waveformatex structure.
for the standard wave_format_adpcm using the standard seven coefficient pairs, this is 32. if extra coefficients are added,
评论0