Well, that's a complex question! The mechanics of the trumpet is based on the harmonic series. The harmonic series is a set of frequencies that are positive integer multiples of a common fundamental frequency. These integers are the notes, which follow them in the following steps: octave, fifth, fourth, triad…and so on. As a trumpet player blowing his instrument, he presses his lips in the corners and makes them resonant with his airstream. That's how frequencies are generated and blew into the trumpet, so if the player doesn't press a single button, he is able to play all notes of the harmonic series. The three valves of the trumpet let or close the air to three different slides with three different lengths. With the mixed-use of the three buttons, he is able to set seven different slide lengths, and the seven half-note steps are able to cover the differences between the fifth of the harmonic series.