0

I'm making audio app on Android with use of some synthesis, FM or AM. I'm using OpenSL for lower latency. I used Audiotrack library and latency was horible, but making a sound is way easier than with OpenSL. 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.

Thanks

Paebbels
  • 15,573
  • 13
  • 70
  • 139
Syntey
  • 147
  • 1
  • 15
  • 5
    I don't see what this has to do with OpenSL ES. Your question seems to be about how one would generate a sawtooth waveform in general. Do you understand the concept of PCM audio? Do you understand what the `%` operator does and how that corresponds to the sawtooth waveform? Have you tried plotting the buffer contents as a graph? – Michael Feb 12 '16 at 14:30
  • What Michael said, this has more to do with signal processing than OpenSL. Think about what a sawtooth wave is (draw it on a graph). You might even want to start with a sine wave (it's easier to understand) before you try to do a sawtooth wave. Look at this before going any further with Open SL: http://programminglife.io/generating-sine-wave-sound-with-android/ – yun Feb 12 '16 at 22:07

0 Answers0