File: README.md

package info (click to toggle)
golang-github-youpy-go-wav 0.3.0%2Bds-1.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, sid, trixie
  • size: 104 kB
  • sloc: makefile: 6
file content (68 lines) | stat: -rw-r--r-- 1,028 bytes parent folder | download
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# go-wav [![Build Status](https://travis-ci.org/youpy/go-wav.png?branch=master)](https://travis-ci.org/youpy/go-wav)

A Go library to read/write WAVE(RIFF waveform Audio) Format

## Usage

```go
package main

import (
	"flag"
	"fmt"
	"github.com/youpy/go-wav"
	"io"
	"os"
)

func main() {
	infile_path := flag.String("infile", "", "wav file to read")
	flag.Parse()

	file, _ := os.Open(*infile_path)
	reader := wav.NewReader(file)

  	defer file.Close()

	for {
		samples, err := reader.ReadSamples()
		if err == io.EOF {
			break
		}

		for _, sample := range samples {
			fmt.Printf("L/R: %d/%d\n", reader.IntValue(sample, 0), reader.IntValue(sample, 1))
		}
	}
}
```

## Supported format

Format

- PCM
- IEEE float (read-only)
- G.711 A-law (read-only)
- G.711 ยต-law (read-only)

Number of channels

- 1(mono)
- 2(stereo)

Bits per sample

- 32-bit
- 24-bit
- 16-bit
- 8-bit

## Documentation

- https://godoc.org/github.com/youpy/go-wav

## See Also

- http://www-mmsp.ece.mcgill.ca/Documents/AudioFormats/WAVE/WAVE.html