-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsound.h
More file actions
27 lines (22 loc) · 938 Bytes
/
sound.h
File metadata and controls
27 lines (22 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
// this header file contains constant definitions and function declarations
// for processing sound, specifically .wav.files.
// #define SDEBUG
typedef struct{
char chunkID[4]; //shouldbe always "RIFF"
int chunkSize; //indicates how big sound data is
char format[4]; //should be always "WAVE"
char subchunk1ID[4]; //should be always "fmt "
int subchunk1Size; //should be 16 for PCM data
short audioFormat; //should be 1 for Linear sample
short numChannels; //1 for mono, 2 for stereo
int sampleRate; //could be 44100, 16000, 8000
int byteRate; //can be calculated
short blockAlign; //how many bytes in one block
short bitsPerSample; //how many bits in one sample
char subchunk2ID[4]; //should be always "data"
int subchunk2Size; //how many bytes exactly for data part
}WAVheader;
// function delarations
WAVheader readwavhdr(FILE *fp);
void displaywavhdr(WAVheader h);
void wavdata(WAVheader h, FILE *fp);