Here's a straightforward and reliable technique for pitchshifting loops to get them in tune with the rest of a project. We're using Ableton Live for demonstration purposes, but any DAW will offer the same functionality.
For more on pitchshifting, pick up Computer Music 220, which is on sale now.
Step 1: Let's use loops from Computer Music magazine's excellent Sample Magic - Future vs. Retro sample pack to demonstrate this basic tuning technique. Load Drums 120bpm.wav and Bass 120bpm.wav. If the sample isn't labelled with a musical key, load an initialised synth patch and play notes until you identify the key - in the case of our bassline, it's clearly in C.
Step 2: Import Chord Riff 120bpm.wav onto another track - it's obviously in a different key to the bass and sounds wrong alongside it. Let's establish the root key of the chords first: solo them and the synth, then play synth notes until you hit the main/root note of the riff - it's A.
Step 3: Now play ascending notes from an A to the nearest C on your MIDI keyboard or piano roll, counting the number of notes between them (semitones). The distance is three semitones, meaning we need to pitch the riff up by this amount. In Ableton Live, we head into the clip and turn up the Transpose dial to 3 st.