You really wanna know? Ok well it will vary with the dog breed and the temperment. It also helps if start this when they are pups. Adult dogs like adult people aren't as flexible in their learning skills. First off it helps if you train your dog to be quiet on command. I use the command 'Settle.' Assuming you have given your dog some basic training, have them lay done. Then treat them periodically while saying settle. Use a soft gentle tone with the dog. Repeat this over several sessions over 2-3 weeks. After awhile your dog will get the picture and understand that "Settle" is a command to be quiet and relax.
To condition it for after a visitor it will require you to be with the dog when someone arrives. The dog will bark. Once you have deemed the barking is sufficient, give the "Settle" command and then treat again. You will need to condition the dog for several more weeks (assuming you have visitors) for the the dog to finally get it. This will take longer than the actual learning of the "Settle" command as a dog is naturally suspicious of strangers.
As a general rule don't train a dog for more than 15 minutes before giving them a 5 minut play break (dogs need play to help with the learning process). Your training sessions can be up to 1 hour long with 4 - 5 minute breaks.