While every object in this world practically makes noise music instruments are designed to produce certain frequencies called the musical pitch. A grand piano is an instrument that produces one of the widest range of pitches. A grand piano has 88 keys and each key hits a certain string inside the body of the piano and produces a sound wave with a unique pitch. This is true about all musical instruments. Rather than just making noise instruments produce sound waves tuned to the musical scale. Below is a image of the 88 keys that can be found on a grand piano and the relation it has to the guitar and the bass guitar.
The main thing to take note about the image above is the frequency that each key produces. Lets take a look at the first key on a piano which is the A key. When this key is played it produces a sound wave with the frequency of 27.5 Hz which is a low frequency but is audible by humans. Now lets take a look at key number 13 which is also an A key. This key, however, is in octave 1 and not octave 0. That means that key 13 (A1) is an octave above key 1 (A0). Also notice that key 13 is twice the pitch of key 1. Basically key 13 produces a frequency precisely twice as much as key 1. If you were to play all of the A notes one after the other you will hear a relevant pitch. This applies to the rest of the keys on a piano.
The image below is an up close look at octave 4 and the intervals.
All other music instruments, such as the guitar and bass, follow the same concept producing sounds that remain within the musical pitch. However bass guitars produce lower sub frequencies while guitars produce higher pitches with clarity. A grand piano produces a wide range of tones from sub frequencies to pitches higher than most musical instruments.