LocalAI/pkg/sound/float32.go
Ettore Di Giacinto 6e60879bfe wip(vad)
Signed-off-by: Ettore Di Giacinto <mudler@localai.io>
2024-12-23 16:00:23 +01:00

13 lines
192 B
Go

package sound
import (
"encoding/binary"
"math"
)
func BytesFloat32(bytes []byte) float32 {
bits := binary.LittleEndian.Uint32(bytes)
float := math.Float32frombits(bits)
return float
}