Skip to content

Latest commit

 

History

7 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wav

A simple Go library for reading PCM WAV audio files.

Usage

import "github.com/djfritz/wav"

w, err := wav.LoadFromFile("audio.wav")
if err != nil {
    // handle error
}

fmt.Println(w.Channels)      // number of channels
fmt.Println(w.Frequency)     // sample rate (e.g., 44100)
fmt.Println(w.BitsPerSample) // e.g., 16
fmt.Println(w.Length())      // duration

Loading from bytes

w, err := wav.Load(data)

Data

The PCM data is arranged as N many channels in the wav.Data field. Each channel has the same number of samples, and is stored as an int regardless of the bits per sample. You will have to scale the data using the BitsPerSample field.

License

BSD 2-Clause

About

Simple WAV file decoder in Go

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages