79237761

Date: 2024-11-29 16:28:43
Score: 1
Natty:
Report link

I didn't really dig through your code, but it looks ok from a pure WebAudio API perspective. However, if your audio is all 0s after conversion to 16bits, the problem is just the conversion itself. Float32 samples are values between 0 and 1, so when you convert the array, values end up all rounded to 0 (plus perhaps the occasional 1). You need to scale the samples before converting. Int16 audio samples should be between -32768 and 32767, so simply multiply every sample by 32768 and then convert to Int16.

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Single line (0.5):
  • Low reputation (0.5):
Posted by: Stefano Bider