There's a music recognition API that gives you 300 requests for free (and you may require your users to get their own API tokens).
It's called AudD, and I think that's the best music recognition API available: the DB contains most of the published songs, it's easy to test and implement in your project.
I have developed an app that does just what you describe.
Currently it features intervals, chords, scales, and perfect pitch training. There is also a random mode where you can shuffle all the above.
I intend to add more functionality soon.
If you want to give it a try, here it is: