Joy! My house seems to have smoke alarms that have both backup batteries and an A/C power source. The builder, no doubt following some awful building code, placed about five thousand things on my ceiling throughout the house. And, indeed, they'll chirp at me when the backup batteries go bad. Despite having a two-color (red/green) LED built into them, there's no visual status code indicating that the battery has gone bad. You just have to wander around and wait for the damn chirp again. This can be quite frustrating, even when you're fully awake.
Amusingly, my builder uses the cheapest alkaline 9-volt batteries available. I've been replacing them with fancy name-brand batteries. I even did a few with much more expensive lithium batteries because I happened to have a small box of them at the time. Guess what the last one I replaced had in it? One of said expensive lithium batteries. I have no idea why or how often these A/C-fed smoke detectors feel a need to check in on how their battery is doing, or how often my house goes without power when I'm not around; it seems that several times a month I'll come home to blinking clocks.
And, just to make matters more like genixia's story: there's a strong correlation between battery failure and room temperature. A warm battery seems to be a happy battery. This means that the beeping always happens at night, after the air conditioning has cooled the house down, when I'd rather be sleeping.
I feel your pain, brother.