Whistles are simple machines with few or no moving parts. In most cases, the sounds they make are activated entirely by air pressure, produced by nothing more than a human breath. Blow into a whistle softly and it makes barely a sound, but put your lungs into it and you will produce a screech that's attention-getting enough to stop most people in their tracks.
How a whistle produces a sound is tricky to explain, but it goes something like this: When you put your lips on a whistle and blow, air travels in two directions. Some of it goes directly from the windway in the mouthpiece and out the duct, or window, that separates the mouthpiece from the whistle's main body. The rest of the air travels into the body, or bore, of the whistle, where it swirls around until pressure from the buildup of one's breath in the bore forces some of that air out through the duct. Depending on the construction of the whistle, air blown softly escapes by merely hitching a ride, if you will, on the outgoing current that's already traveling directly from the mouth, through the windway, and out the duct. But if the pressure inside the bore is strong enough, the air in the bore will break through the windway's current of air and rush out of the bore and through the duct. The result, roughly speaking, is the sound of a whistle.
Some whistles have a small ball, or pea, in their bores, but such objects have little to do with the actual production of the sound itself. Rather, these small balls change the character of the sound, making it more shrill and rattling, which is why whistles with peas are favored by sports referees needing to get the attention of an athlete on a field or court.
More collected than sports whistles—sometimes called button whistles, depending on their construction—are police whistles, the most famous of which were manufactured in the Victorian Era by a Birmingham, England, tinkerer named Joseph Hudson, whose Acme Whistles remains one of the world's leading whistle manufacturers. In addition to whistles bearing the Acme stamp (supplemented with brand names like Thunderer and Siren), Hudson was famous for his Metropolitan police whistles, which are cylindrical rather than snail shaped and feature two ducts rather than just one.