I use FL studio and it has a built-in plugin called edison with which you can determine the key of a sample. it probably was in the key it said (i think it was F) but it just didn't sound good with the rest of the beat. I usually build basslines around the samples, so they were in the same key...