Play sound at a specific frequency in android

I want to play sound of a certain frequency in android based on user input, somewhat similar to a guitar app. Can someone tell me how to do this? Do I need all the freq sounds in the res \ raw folder?

+3
source share
3 answers

No, you do not need to store this in resources. I think the best approach is to synthesize tones in real time. To do this, you will need the following:

  • java.lang.Math to compute trigonometric functions to fill the buffer (after converting from float to PCM (int)) with the correct tone
  • android.media.AudioTrack ( ). , , - . , Android. , .
  • android.media.audiofx
+4

AudioTrack .

+2

, .

"", (, , , , ) "" , , ..?

( ), Desiderio , "" , "" /res/raw /assets.

SoundPool "", , "" 2 , , , . "" 0,5 , .

+1

Source: https://habr.com/ru/post/1779942/


All Articles