Audio to Midi - 'audio labeling' / transient detection

Say I want to implement a feature in a JUCE application which allows for a midi sequence to be generated that takes in audio (.wav etc.) and maps similar, repeating transients into a particular midi key. I’m not necessarily talking about pitch detection (tho any relevant info helps!), but instead a way of distinguishing the different elements in a generated drum sample. I think this feature is already in most DAWs but i’m not sure if an existing JUCE implementation has been established that you guys could explain. Or in the case that someone has attempted this before and has a general direction to point me in, that would be just as helpful. Thanks!

There are some open source examples of this kind of thing around, e.g. or