I think it comes natural to them.Mine go CRAZY when they hear my husbands car pull up outside or if they hear the door bell.Sometimes someone will pass infront of our door to go up to the next floor (we live in a block of apartments) and they will here that too,even if we dont!
They hear EVERYTHING and when they think someone is coming or something isnt right,they bark
More than once Iv had to apologize for the barking when someone has come to visit lol.