AGraph is a graph based audio processing library for Go! Inspired from implementing binaural audio virtualization with Libavfilter and frustrated by the severe lack of audio processing libraries for Go, I decided to make my own.
Using this library is simple, all you need to do is initialize filter nodes, connect them, start each node, then feed your wave pulse code modulated (PCM) data into the first sink. Below is an example of creating an audio file reader, setting up a graph with a convolution filter and a volume filter, and pumping data through it.
reader, err := agraph.NewWaveReader(file)
if err != nil {
fmt.Println(err)
}
convolutionNode, _ := agraph.NewNode(agraph.ConvolutionFilter, "convoluter")
volumeNode, _ := agraph.NewNode(agraph.VolumeFilter, "volume booster")
convolutionNode.SetSink(volumeNode.Source())
volumeNode.SetSink(make(chan []float64, agraph.SOURCE_SIZE)
go convolutionNode.Process()
go volumeNode.Process()
for {
data, err := reader.ReadSampleFloat()
if err ! nil {
fmt.Error(err)
break
}
convolutionNode.Source() <- data
filteredData = <- volumeNode.Sink()
}
wave file readingwave file writing- Convolution filter
Delay Filter- Finite Impulse Response filter
volume filter(was the first filter, so is technically not correct in many ways)- leaky integrator filter
- FFT
- some frequency domain filters