I've had this coded up before, the problem is that if you want to "pitch
shift" each sample individually it really does become pretty heavy on the
CPU. Unless your not *dynamically* changing the value of the pitch shift,
in which case it can be rendered to a buffer & just played back.
I would share the source if it was in better condition, most of it is hacks
on hacks for extra random features... but I can zip it & ship it to
somebody if they'd care to take a look. A JACK client wrapper would need to
be coded up, its only the "sampler / pitch shifter" now.
Best free library from timestretch I know of is the
RubberBand one.
There is also SoundTouch, its LGPL even more relaxed than the GPL of
RubberBand. Its what I used for the project mentioned above.
Cheers, -Harry