Making audio synthesis with OpenSL


Hello, I’m making audio app on Android with use of some synthesis, FM or AM. I started with Native Audio project. Little bit of sound generation is there, but I don’t know how I can continue with it.

Here is code for sawtooth sound

for (i = 0; i < SAWTOOTH_FRAMES; ++i) {
    sawtoothBuffer[i] = 32768 - ((i % 100) * 660);

Can someone explain me why these numbers? I looked into OpenSL API, but nothing found about synthesizing sound.



Yes, but about synthesis is nothing there.

About my question… I figured it out, it’s actually pretty easy, but I got another problem.

Generating of sawtooth wave is fine. I printed out the result and it’s looking good. But the sound is weird.
Here is what I recorded.
It’s same for sawtooth and square, but when I play with sawtooth A, then sound is normal
Does someone know what is wrong? If I increase size of buffer, then period is longer, but still the same problem