Yes, when coasting, a diesel engine is mostly "freewheeling" because there is no throttle plate. In a gasoline engine, the throttle plate is mostly closed, making for a high vacuum in the intake manifold. This high vacuum starves the cylinders of air, making for greater engine braking.
In a diesel engine there is no throttle, meaning the engine is always operating with full manifold pressure. Even without any fuel injected, the energy used to compress the air is roughly returned on the downstroke, minus friction of the engine and the tiny bit of energy lost to compressive heating which is lost to the metal surfaces. Think of it as a spring.
The Jacobs Brake bleeds this high pressure air at top dead center, effectively dissipating the energy. A part of that energy comes out as sound.