Open ajzaff opened 4 years ago
https://github.com/faiface/beep/blob/b573886bdf0f6ac1b8e7f8931a2a2b249c90666b/speaker/speaker.go#L121
Currently this returns the wrong values for an input of -1.
I believe this should fix it:
valInt16 = int16((-1<<15)+(val+1)/2*(1<<16-1))
https://play.golang.org/p/E-8wkFoIHQ3
Fun fact, in the latest release of Oto the samples get converted back to floats. Maybe a better option to just pass raw float bytes to Oto and skip the conversion altogether.
https://github.com/faiface/beep/blob/b573886bdf0f6ac1b8e7f8931a2a2b249c90666b/speaker/speaker.go#L121
Currently this returns the wrong values for an input of -1.
I believe this should fix it:
https://play.golang.org/p/E-8wkFoIHQ3