On 1 sep, 10:01, guruk <[email protected]> wrote: > thanks for all comments. > does anyone have a simple source demo. > I could try that > buffer[i] = (short) ( Math.sin((2. * Math.PI * i * f) / samplerate) * > Short.MAX_VALUE ) > ... and what afterwards, how to play it? > > I am just wondering ( please i am a total newbie in sound) > when I fill always a buffer like above... how long is that sound??
That depends on how many samples you write. The AudioTrack object plays samples at a certain rate, for example 22050 Hz. To create a 1 second tone, you would thus have to write 22050 samples. I am not familiar with android's AudioTrack interface, but I'm sure the reference manual will help you there. I suppose when you call play () it will start playing as soon as you write enough data to it with write(). So you can generate the tone while it's playing. It's not a completely trivial subject as you have to get into how digital audio actually works, so if you're completely new to that you might want to try to find some kind of library to help you out. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en -~----------~----~----~----~------~----~------~--~---

