The pitch of a sound is determined by the frequency of the sound wave. The higher the frequency, the higher the pitch. When you tighten a guitar string, you increase the tension of the string, which causes the string to vibrate faster and produce a higher pitch. When you loosen a guitar string, you decrease the tension of the string, which causes the string to vibrate slower and produce a lower pitch.