Yes, it's quite easy. Either use time and pitch machine or cut your sample into a perfect 4 bar (or however many bars the sample is), go to the bottom right corner of the audio file until you see the bracket icon, press and hold the option key while dragging the audio file to where you want it time stretched to.