2

as far as I know, there is no simple way in Android to generate a beep (equivalent to Console.Beep(int frequency, int length) in .NET). The only one that looked promising - ToneGenerator class, can generate only a limited selection of tones.

Do I have to generate a waveform by hand, push its data to AudioTrack and play it or is there a library or open source code that does it?

Axarydax
  • 16,353
  • 21
  • 92
  • 151

2 Answers2

1

I've been looking for the same. Found on this very site an answer:

  1. Calculate numbers for a waveform with a given frequency
  2. Convert the resulting array to PCM format
  3. Feed AudioTrack to play it back.

That's a good start.

I don't have the URL but you will find the code easily in FAQ looking for someone asking for "...arbitrary frequency"

takrl
  • 6,356
  • 3
  • 60
  • 69
1

Take a look at Playing an arbitrary tone with Android and Generate And Play A Tone In Android.

Community
  • 1
  • 1
uTubeFan
  • 6,664
  • 12
  • 41
  • 65