Go binding for libfaac. See AudioCoding.com for more info about FAAC.
sampleRate := 48000
channelCount := 2
faacEncoder := faac.Open(sampleRate, channelCount)
config := faac.EncoderConfiguration{
BitRate: 48000,
InputFormat: faac.InputFloat,
}
err := faacEncoder.SetConfiguration(&config)
if err != nil {
// ...
}
encodedBytes = faacEncoder.OutputBuffer()
var interleavedFloats = []float
// fill interleavedFloats for floats between +/- 32768.0
// len(interleavedFloats) must be (less than) faacEncoder.InputSamples()
// ...
encodedByteCount := faacEncoder.EncodeFloats(
interleavedFloats,
encodedBytes)
if encodedByteCount > 0 {
writer.write encoder.encodedBytes[0:encodedByteCount]
}
faacEncoder.Close()