Re:C++ audio mixing library design
by lisyarus on Monday October 17, 2022 @03:45AM
(#33230786)
The alternative that my older code used was int16, and it has way bigger precision issues (32-bit float has 23 bits of precision, and in16 has 15). Fundamentally audio samples are just numbers; the fact that they have to be in the [-1..1] range in the end is a hardware technical limitation (the speakers' membranes can only vibrate so much), but there's nothing in the audio itself that says it should be constrained to some range. So, floating-points are a nice fit. Fixed-point math like 16.16 might be a good alternative, but floats have hardware support, so here we go.
[ Parent
| on HN ]
Re:C++ audio mixing library design
by PennRobotics on Monday October 17, 2022 @05:02AM
(#33231230)
The smallest nitpick: The accepted variable for frequency is f or nu (ν). The formula and units are correct in the article, but lowercase omega is understood as angular frequency and would take the place of 2πf. I also got 3 hours of sleep, so I could be wrong.
Also, thanks for the great article and a possible alternative to my own SDL_mixer woes!