0

I am facing an issue regarding playing the tone on a particular frequency. I used the ToneGenerator class as instructed by ChatGPT. I am unable to play it on a specific frequency.

I tried this:

private val generator = ToneGenerator(AudioManager.STREAM_RING, 100)

fun Beep(frequency: Float) {
generator.startTone(ToneManager.TONE_DTMF_0, 1000, 200) // Desired Frequency: 200
}

But it seems the 3rd parameter doesn't exist now. Is it possible to use the same tone generator to play any frequency?

asm0dey
  • 2,841
  • 2
  • 20
  • 33
  • Does this answer your question? [Playing an arbitrary tone with Android](https://stackoverflow.com/questions/2413426/playing-an-arbitrary-tone-with-android) – k314159 Jul 24 '23 at 11:38
  • 1
    Careful with ChatGPT--it very confidently tells you completely false information like this. A 3rd parameter has *never* existed for this class. ToneGenerator cannot play tones at arbitrary frequencies. – Tenfour04 Jul 24 '23 at 13:03

0 Answers0