My boat has a bit of quite crappy foam as sound proofing. In the aft cabin the back end of the engine bay is removable and theres a 1 cm gap so plenty of noise gets out.
But heres the thing, I have slept in that cabin at sea numerous times with the engine going. It just seems to blink off when I nod off! Weird.
So a noisy engine right next to someones head may appear to be a real pain, but its a constant noise and one soon gets used to it