Recently, I tested a trumpet after repairing a valve problem. The second valve slide was very loose and it vibrated as I played. Then I noticed something that I had never seen before even having tested thousands of trumpets. When I played the low F#, the slide rattled its way out. Then, after playing a little more, on the low B, the slide worked its way back into place. This was so odd that I had to make a video of it.
After contemplating the phenomena, I figured out the forces at work. When you play a trumpet, or any other wind instrument, there are high pressures and low pressures at various points in the instrument. These places change with the frequency of the note that is being played. So in my case, it happened to be that on the low F#, the point of high pressure was at the 2nd valve slide, and on the low B, the low pressure point was there. (Along the same lines; if you play a trumpet with the water key open, most of the notes sound very airy and bad, but a few are not affected at all.)
P.S. As interesting as I found the wandering slide, I did tighten it before I gave it back to the customer. They likely would not have found it very interesting if their slide fell out during a performance.