Too add to what Nick just posted, above; a lot depends on the steam supplied to the whistle. Many railroads chose to have the whistle supplied with superheated steam as compared to saturated (cooler) steam.
Also, many railroads had an air operated control cylinder to open and close the whistle steam supply, thus all the Engineer had to do was press down on a small brass lever, which controlled the air supply to the whistle operating cylinder (SP cab forwards and GS class 4-8-4s had such arrangements).