Android Audiotrack snaps noise with Android 4 ICS

I also have a piano keyboard built into my application. I ran into a problem with audiotrack by setting playbackRate using setPlayBackRate(...) . To get the next halftone on the keyboard, I change the playback speed using this formula:

 int playbackRate = (int) (Math.pow(2.0, (1.0/12.0)) * 44100); audioTrack.setPlaybackRate(playbackRate); 

this works well on Android 2.2.1 and 2.3.5 , but on 4.0/4.1.2 (Galaxy Nexus) I get a click when playing sound.

Any ideas how to fix this?

Thank you in advance

+4
source share

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


All Articles