Search code examples
audiolibgdxpcm

LibGDX, Android audio spectrum analyse from MP3


I'm trying to make a game that generate level from an audio track (MP3).

But LibGDX audio analyse support was removed since 2012, and other methods I found on the web are not available for Android.

The only thing I need at the moment is to read the PCM from an MP3, I used other libraries than read PCM, but only from the microphone...

Maybe is it possible to do this in the Android module part and exploit it from the core ? Or I have to find a workaround in java to do it in the core ?...


Solution

  • A new libGDX extension called gdx-pd allows to use pure data in libGDX, pure data is a powerfull procedural audio library providing among other realtime audio analysis tools like FFT out of the box : https://github.com/mgsx-dev/gdx-pd

    Once you have PCM stream you can process it in realtime or at loading time. Here is an example : https://github.com/mgsx-dev/gdx-pd/blob/master/tests/desktop/src/net/mgsx/pd/AudioGdxBakingTest.java of sound baking at loading time. You will need some extra work to output result of analysis using either audio output stream or pure data arrays.

    This extension is available for both desktop and Android targets.