I’ve worked through it a bit to figure out some things like multiple tones, and I understand nearly all of it, but I don’t know why there’s the
128 + 127 * in there.
It also shows up here in this demo page.
Can anyone offer an explination or tell me how I can use that part to modify the program?
The examples that you referenced show an equation in the form:
A=128 + 127 * Sin(...)
Sin function can vary from -1 to +1, the result of the above equation is 1-255. So, adding the constant
128 and multiplying by the coefficient
127, this is basically a
sin function whose output varies between 1 and 255, which is convenient because it can be stored using 8 bits (or 1 byte).