Android: How to mix 2 audio files and reproduce them with soundPool

前端 未结 2 506
梦毁少年i
梦毁少年i 2021-01-06 19:34

I\'m trying to develop an Android aplication that uses some sounds and mix them together for creating music compositions. At the beggining I tried just to reproduce sounds a

相关标签:
2条回答
  • 2021-01-06 19:57

    If you were using raw PCM data, averaging the samples would work fine. What you need to do is convert the OGG file into a PCM buffer first. If you'd like to keep the output as OGG, you'll need to convert that back after you're done.

    My experience is mostly with MP3 libraries rather than OGG, but I hear good things about JOrbis.

    0 讨论(0)
  • 2021-01-06 19:58

    In this way

    soundPool = new SoundPool(NUM_SOUNDS, AudioManager.STREAM_MUSIC, 0);
    

    NUM_SOUNDS is the number sounds soundPool can play togheter.

    0 讨论(0)
提交回复
热议问题