Sound detection library for android without using mic

I am creating an android application that plays a beep sound whenever it detects a pre-defined sound. In another way, I have three drum/piano/vocal sequence mp3 file with me which is stored along with the apk assets. After installation, the three files moved to the internal memory. Whenever I play any audio/video in any of the video/audio player(eg:youtube/vlc) on my mobile, if the music sequence of the playing audio matches any of the already stored three mp3 files, Then a beep sound should produce. This is my aim. But I am hard to find such a library to compare music that is playing inside the mobile with another app. Google assistant and Shazam app just listen to audio from the mic and compare the audio. But in my case, I need to compare audio which is the playing device itself.

Note: The app will be running 24X7 by listening to the sounds played on the device. This application is not intended to build an unethical product. This is used for industrial purposes.

If somebody needs more clarification, I will update the question