This is because the length of the tube affects the speed at which the sound waves travel through the instrument. The longer the tube, the longer it takes for the sound waves to travel through it, and the lower the pitch of the sound that is produced. Conversely, the shorter the tube, the faster the sound waves travel through it, and the higher the pitch of the sound that is produced.
The length of the tube also affects the timbre of the instrument. The longer the tube, the mellower and more resonant the sound of the instrument. Conversely, the shorter the tube, the brighter and more piercing the sound of the instrument.
The length of the tube is one of the most important factors that determines the pitch and timbre of a brass instrument. By carefully designing the length of the tube, instrument makers can create instruments with a wide range of pitches and timbres.