Valves open and close lengths of tubing, thereby changing the instrument's pitch. The piston valves you see on a trumpet or a tuba open the tubing when the player presses the key, then shut again when the pressure is released.  When a rotary valve is depressed, the valve rotates 90 degrees and opens the connection. Piston valves have a cleaner definition between notes, while rotary valves have a more mellow and rounded sound.