I fixed up the graintsynth. And found some bugs with the shiftsample function. The shiftsample function, in conjunction with the grainsynth function, works perfectly.