try little endian

live
noah metz 2024-04-08 17:32:49 -06:00
parent e69ec41ed4
commit 8b697a13ae
1 changed files with 2 additions and 2 deletions

@ -116,7 +116,7 @@ func main() {
onRecvFrames := func(output_samples []byte, input_samples []byte, framecount uint32) { onRecvFrames := func(output_samples []byte, input_samples []byte, framecount uint32) {
pcm := make([]int16, len(input_samples)/2) pcm := make([]int16, len(input_samples)/2)
for i := 0; i < len(input_samples)/2; i++ { for i := 0; i < len(input_samples)/2; i++ {
pcm[i] = int16(binary.BigEndian.Uint16(input_samples[2*i:])) pcm[i] = int16(binary.LittleEndian.Uint16(input_samples[2*i:]))
} }
data := make([]byte, len(input_samples)) data := make([]byte, len(input_samples))
@ -193,7 +193,7 @@ func main() {
} }
data := make([]byte, written*2) data := make([]byte, written*2)
for i := 0; i < written; i++ { for i := 0; i < written; i++ {
binary.BigEndian.PutUint16(data[i*2:], uint16(pcm[i])) binary.LittleEndian.PutUint16(data[i*2:], uint16(pcm[i]))
} }
speaker <- data speaker <- data
} }