Is there any method to add rate as an frequency in soundpool class. Here is my code. how can i pass hz(frequency at place of 1f that is rate.
fun playSound(v: View) {
when (v.getId()) {
R.id.button_sound1 -> {
soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 1f)
//soundPool.pause(sound3StreamId);
// soundPool!!.autoPause()
}
R.id.button_sound2 -> soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 0.8f)
R.id.button_sound3 -> soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 1.1f)
R.id.button_sound4 -> soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 1.4f)
R.id.button_sound5 -> soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 1.7f)
R.id.button_sound6 -> soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 2f)
R.id.button_sound7 -> soundPool!!.play(sound1!!, 1f, 1f, 0, 0, 2.3f)
}
}
1f 1f - You can check in docs is a volume left and rigth
You change the frequency - in Your sound file. If You put there 20 hz it will be 20 kHz if You put there 64 kHz it will play 64 kHz.
metronome2 = this.soundPool.load(gameSurface.app.context, R.raw.metronome2wav, 1);
check properties of this file.
pb