the only way is by ear .... u have to tune the sample properly then make sure ur playin notes in the right key ... a good trick that works is using a diffrent sound that stands out more than a bass, get the pattern and key correct, and then just substitute that sound with ur bassline. Cake...