You will have to create the wave data yourself using a sine-function.
Fill a buffer of shorts (for 16 bit audio) with something like this:

buffer[i] = (short) (Math.sin(((double) i / samplerate) * f) *
Short.MAX_VALUE);

(please correct me if I'm wrong)

If you need a 5 seconds tone, I suppose you could just fill a buffer
of size 5 * samplerate, but you could also try something smart with a
loop and repeatedly feed the same buffer to the AudioTrack object.
Just be aware of rounding errors and aliasing.



On 31 aug, 20:28, Eduardo Aquiles <[email protected]> wrote:
> You could use AudioTrack. But you will need to create the data to send
> to it.
>
> On Aug 31, 2:19 pm, guruk <[email protected]> wrote:
>
> > sorry i just dont find that simple thing.
> > how to create a tone lets say 10khz / 5 secs
>
> > something like that,, just play a individual created sound, not
> > playing a mpg or so?
>
> > any example will be helpful
>
> > thx
> > chri
>
>
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to