Hi.
Load Melodyne as a VSTi effect on to the channel you have the audio sample/loop.
Press the ''transfer'' button in Melodyne and then play the audio - it will record in to the programme.
Then, use the convert to midi file command in Melodyne and save the file - import that back in to your DAW and you are good to go, job done, etc.
If the audio contains a lot of reverb, delay, background sounds, etc - you may need to EQ it or use a gate plug- in to get a clean take for Melodyne to detect the correct pitches.
Good luck