#include <stdio.h>
#include <string.h> #include <sys/stat.h> typedef unsigned short uint16; typedef unsigned int uint32; #pragma pack(push, 1) // pcm文件头 typedef struct { uint32 ChunkID; //00H 4 char "RIFF"标志 uint32 ChunkSize; //04H 4 long int 文件长度 文总长-8 uint32 Format; //08H 4 char "WAVE"标志 uint32 SubChunk1ID; //0CH 4 char "fmt "标志 uint32 SubChunk1Size; //10H 4 0x10000000H(PCM)过渡字节(不定) uint16 AudioFormat; //14H 2 int 格式类别(0x01H为PCM形式的声音数据) 0x0100H uint16 NumChannels; //16H 2 int 通道数,单声道为1,双声道为2 uint32 SampleRate; //18H 4 int 采样率(每秒样本数),表示每个通道的播放速度, uint32 ByteRate; //1CH 4 long int 波形音频数据传送速率,其值Channels×SamplesPerSec×BitsPerSample/8 uint16 BlockAlign; //20H 2 int 数据块的调整数(按字节算的),其值为Channels×BitsPerSample/8 uint16 BitsPerSample; //22H 2 每样本的数据位数,表示每个声道中各个样本的数据位数。如果有多个声道,对每个声道而言,样本大小都一样。 uint32 DataTag; //24H 4 char 数据标记符"data" uint32 DataLen; //28H 4 long int 语音数据的长度(文长-44) }PCM_HEAD, *PPCM_HEAD; // a-law文件头 size:44 typedef struct { uint32 ChunkID; //00H 4 char "RIFF"标志 uint32 ChunkSize; //04H 4 long int 文件长度 文总长-8 uint32 Format; //08H 4 char "WAVE"标志 uint32 SubChunk1ID; //0CH 4 char "fmt "标志 uint32 SubChunk1Size; //10H 4 0x12000000H(ALAW) uint16 AudioFormat; //14H 2 int 格式类别 0x0600H uint16 NumChannels; //16H 2 int 通道数,单声道为1,双声道为2 uint32 SampleRate; //18H 4 int 采样率(每秒样本数),表示每个通道的播放速度, uint32 ByteRate; //1CH 4 long int 波形音频数据传送速率,其值Channels×SamplesPerSec×BitsPerSample/8 uint16 BlockAlign; //20H 2 int 数据块的调整数(按字节算的),其值为Channels×BitsPerSample/8 //uint16 BitsPerSample; //22H 2 每样本的数据位数&# |
把双声道alaw编码文件拆分为两个单声道PCM文件
最新推荐文章于 2021-05-22 22:44:28 发布