That classic noise is a Reciprocating Air Compressor, which is a piston just like on the side of a steam locomotive. Powered by an electric motor at the "wheel end", it takes in air, compresses it, and puts it into the air brake pipe. The noise is the piston itself going backwards and forwards. Different designs had different speeds and thus different noises, over the years they seemed to get faster. Old London Underground trains had the same equipment and noise. In more recent times a different type of rotary compressor has become standard which makes a continuous and quieter noise. The compressor has a sensor switch on the air pipe, which starts it when the pressure starts to fall off and stops when full pressure is reached (for you mechanical engineers I'm reducing this to basics

)
The pressure in air brakes is about 7 times atmospheric pressure so the piston has to compress air to one-seventh of its initial volume to get it through valves into the air pipes. Westinghouse was the dominant manufacturer, and indeed patent holder, and air brakes were often referred to as Westinghouse brakes.
Most steam locomotives in Britain used vacuum brakes, but there were a few for special rolling stock with air brakes, and they also had steam-powered reciprocating compressors, often mounted on the outside of the boiler, which made a comparable but even louder noise when pumping up air pressure. Suburban services from Liverpool Street used this type of brake, and until the electrification of the 1960s the sound of multiple "N7s" across the station pumping up air was the dominant noise of the station.