https://github.com/jfreymuth/oggvorbis
a native go ogg/vorbis decoder
https://github.com/jfreymuth/oggvorbis
go ogg-vorbis
Last synced: 5 months ago
JSON representation
a native go ogg/vorbis decoder
- Host: GitHub
- URL: https://github.com/jfreymuth/oggvorbis
- Owner: jfreymuth
- License: mit
- Created: 2016-11-24T12:02:47.000Z (over 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-21T21:00:07.000Z (over 3 years ago)
- Last Synced: 2024-06-18T15:31:17.432Z (about 2 years ago)
- Topics: go, ogg-vorbis
- Language: Go
- Size: 166 KB
- Stars: 66
- Watchers: 3
- Forks: 4
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# oggvorbis
a native go ogg/vorbis decoder
[](https://godocs.io/github.com/jfreymuth/oggvorbis)
## Usage
This package provides the type oggvorbis.Reader, which can be used to read .ogg files.
r, err := oggvorbis.NewReader(reader)
// handle error
fmt.Println(r.SampleRate())
fmt.Println(r.Channels())
buffer := make([]float32, 8192)
for {
n, err := r.Read(buffer)
// use buffer[:n]
if err == io.EOF {
break
}
if err != nil {
// handle error
}
}
The reader also provides methods for seeking, these will only work if the reader
was created from an io.ReadSeeker.
There are also convenience functions to read an entire (small) file, similar to ioutil.ReadAll.
data, format, err := oggvorbis.ReadAll(reader)