The sound changes frequency in a regular pattern, and almost sounds electronic, like an old radio with a bad antenna. We can only hear it in these two bathrooms, and it occurs whether or not the water is running. There is another bathroom right below, but we cannot hear the noise there.
All drains must be vented to the atmosphere, to allow water to exit smoothly.. Vent pipes (on the roof, can act as pitch pipes, as the wind blows across them.
Clogs (or restrictions-soon-to-be clogs) in the drain pipes can cause water to rise into the vent pipe, changing the pitch as the water level varies.
Sometimes a bird can block the pipe with a nest or other critter can bodily block the pipe.
In any case, checking the main vent pipe is a the first order.