title: How to Play 'Tick Tick' Sound with Android Animation (possibly with `Android MediaPlayer / SoundPool`)?
body: <p>I have a custom view (<code>PieView</code>) that is has a rotating animation. Now I would like to play <code>tick tick tick tick...</code> sound synchronously with the rotation speed (that is, when the rotation speed is fast, the tick tick should be fast, when rotation is slow, the tick tick should be slow).
  To do this, first I created an mp3 file named <code>magicbox_tick.mp3</code> that has only ONE (1) tick. Next I tried to play the sound with <code>Animation.setUpdateListener()</code>.</p>
  
  <p>First I tried to play music with <code>MediaPlayer</code> but after some 10 or 15 ticks, it stoped. So now I am trying <code>SoundPool</code> to play the music.</p>
  
  <p>The relevant code segment looks like this:</p>
  
  <pre><code>public PieView extends View {
    // ... constructors, other methods etc
    private SoundPool soundPool;
    private int soundId;
  
    void init(){  // called inside those constructors
          SoundPool soundPool = new SoundPool(5, AudioManager.STREAM_MUSIC, 0);
          soundId = soundPool.load(getContext(), R.raw.magicbox_tick, 1);
    }
  
    public void rotateTo(){
      animate()..setInterpolator(new DecelerateInterpolator())
                  .setDuration(mDuration)
                  .setListener(someListener)
                  .rotation(targetAngle)
                  .setUpdateListener(animation -&gt; {
                      myPlaySound();  // &lt;----------------------- This is the sound playing code
                  })
                  .start();
    }
  
    void myPlaySound(){
            soundPool.play(soundId, 1, 1, 0, 0, 1); // this doesnot play the `tick` sound
            // previously I used MediaPlayer like this:
           /*
              MediaPlayer mp = new MediaPlayer.create(getContext(), R.raw.magicbox_tick);
              mp.play(); 
                 // these 2 line, after some 10 ticks, stopped working. 
            */
    }
  
  }
  </code></pre>
  
  <p>I have never done anything like this, and I don't know how to fix this. Can anyone help me?
  Please note that I am open to all answers as long as it works. You don't have to use <code>SoundPool</code>. So suppose if you can make it work with android <code>MediaPlayer</code>, I am ok with that.</p>