It's a boy for Fergie and Josh Duhamel!

The 40-year-old actor announced the news during an appearance on "Live With Kelly and Michael" that will air in full on Wednesday.

Duhamel revealed the sex of the baby during a game called "Du or Don't, Part II: Baby Edition." During the segment, Kelly Ripa held up a pink onesie and a blue onesie and asked the daddy-to-be to choose one.

After playing coy and polling the audience for their guess, Duhamel picked the blue one and proudly held it up to the camera.

The baby is due this August.

"We're over the moon about it," Duhamel said of his wife's pregnancy during an April appearance on "Chelsea Lately." "We've been trying for this for quite awhile.

"Until you actually go through it yourself, because you know all my friends have told me about it, they've said, 'You know, it's the most amazing thing you've ever been through; wait until you hold the baby for the first time,' and then you actually look at her and you see that there's an actual baby inside of there. It's unbelievable," he shared.

Fergie, who recently made headlines for officially changing her name to Fergie Duhamel so that her whole family would have the same last name, says that her husband is already a perfect papa.

"He's so nice and wonderful," she said. "He sings and talks to my belly all the time. He's very complimentary. I'm very lucky that he's really good to me... He's going to be an amazing father."

Duhamel also said he's dedicated to "raising this kid right," even if it means making adjustments when it come to his career.

"I can't imagine having a kid and then not being able to be there - that would just drive me crazy. My head would be at home with mom and baby," the actor said recently. "We want to work it out so that we can be together; whether I am working, they can come with [me] or if she is working I can go with them. I can't see myself ever wanting to be away from my wife and kid," he said.