Hi Andrea, check out the technique described in section 9.6 of Miller's book: Phase bashing. It's implemented as I10.phase.bash.pd in Pd's built-in documentation. It's more complicated than the doppler-based shifting you're looking at, but it's dramatically better for preserving the timbre of the original input signal. Doppler and playback speed solutions (which is what granular pitch shifting usually involves) will stretch and contract the spectral envelope, which can cause serious aliasing. There are also the pitch halving and
doubling techniques in E03.octave.divider.pd and
G06.octave.doubler.pd, which add or remove harmonics in ways that don't disturb the spectral envelope too much and therefore still sound natural. Of course, then you're limited to octave jumps which is probably not what you want.
I know you're not looking for extern suggestions, but if you download [tune~] from deken, you can see how I adapted the phase bash patch for real-time use. It might be useful in connection with Miller's original patch for understanding the technique.