You can use an Android class called Visualizer; it allows you to access audio being played: Official Android
Please refer to this link to find some example you can download; you can start from one of that, modifying what you need.
Please find here another example to donwload.