16 lines
367 B
Go
16 lines
367 B
Go
package audio
|
|
|
|
// InterleavedStereoToMono converts interleaved stereo to mono samples.
|
|
//
|
|
// The size of src should be twice the size of dst. No bounds checking
|
|
// is performed while writing to dst.
|
|
func InterleavedStereoToMono(dst, src Slice) {
|
|
var (
|
|
i, j int
|
|
l = src.Len() / 2
|
|
)
|
|
for ; i < l; i, j = i+1, j+2 {
|
|
dst.Set(i, (src.At(j)+src.At(j+1))/2)
|
|
}
|
|
}
|