When you play a sound with SamplePlayer with only the sound name parameter, it returns a number identifying the instance of the sound being played (a.k.a the "voice"). Once the sound finishes the voice is no longer valid and may be reused for next plays.
Changing the pitch of a voice can be done this way then:
var voice = sample_player.play("moo")
# pitch of 1.0 means no change, 2.0 means x2, 0.5 means /2 etc
sample_player.set_pitch_scale(voice, 2.0)
# Can be changed later on as long as the voice is still playing
On SamplePlayer2D the function is voice_set_pitch_scale
, not sure why the name is different but I just remind you in case you would get confused.
This is documented here, take some time to see all functions available (for example you may also be looking for is_voice_active
) but I don't know personally of a from-scratch tutorial about all concepts involved in sound playback in Godot.