-
Notifications
You must be signed in to change notification settings - Fork 42
/
Copy pathheaders.go
45 lines (39 loc) · 859 Bytes
/
headers.go
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package wav
import "time"
const (
maxSize = 2 << 31
)
var (
tokenRiff = [4]byte{'R', 'I', 'F', 'F'}
tokenWaveFormat = [4]byte{'W', 'A', 'V', 'E'}
tokenChunkFmt = [4]byte{'f', 'm', 't', ' '}
tokenData = [4]byte{'d', 'a', 't', 'a'}
)
// File describes the WAV file
type File struct {
SampleRate uint32
SignificantBits uint16
Channels uint16
NumberOfSamples uint32
Duration time.Duration
AudioFormat uint16
SoundSize uint32
Canonical bool
BytesPerSecond uint32
}
// 12 byte header
type riffHeader struct {
Ftype [4]byte
ChunkSize uint32
ChunkFormat [4]byte
}
// 20
type riffChunkFmt struct {
LengthOfHeader uint32
AudioFormat uint16 // 1 = PCM not compressed
NumChannels uint16
SampleRate uint32
BytesPerSec uint32
BytesPerBloc uint16
BitsPerSample uint16
}