This code will tell you if Music is playing, although you won't be able to do anything about music playing from other apps as you won't have access to the player instance to turn it off. The best you could do is to turn the volume down.
If you just want to check before playing your own sounds, then this should work fine.
It uses the AudioManager API, and requires the Reflection library.
B4X:
Dim R As Reflector
R.Target=R.GetContext
R.Target=R.RunMethod2("getSystemService","audio","java.lang.String")
Label1.Text=R.RunMethod("isMusicActive")