As noted on page 297 of the book "A Text-Book of Physics" (pub. 1911), the "chuffing" sound produced by steam locomotives is produced in the smokebox, by the firing of exhaust gases (from each exhaust stroke from the cylinders) through the exhaust pipe (which is actually a nozzle called a blastpipe) into the smokestack.

One of principles of acoustic resonance tells us that the resonance (frequency) of a tube of air is related to the length of the tube and its shape. In general, the larger the (volume of the) smokebox and smokestack, the lower the (fundamental) frequency of the "chuffs" produced by the locomotive. In other words, in general, the "chuffs" produced by small switching locomotive are typically higher in pitch than the "chuffs" produced by a larger locomotive. However, the size of the nozzle opening, the distance of the nozzle from the smokestack's chimney, and other factors will also effect the pitch and timbre of the "chuff" sounds.