Bonnie McKee writes party-ready pop songs streaked with sadness, and one source of that sadness might be that she hasn't been the person singing them.

The L.A.-based songwriter is partially responsible for some of the biggest hit singles of the last few years: Britney Spears' "Hold It Against Me," Taio Cruz's "Dynamite" and a string of No. 1s by her friend Katy Perry, including "California Gurls," "Teenage Dream" and "Roar," the last of which hasn't left the top 10 of Billboard's Hot 100 since August.

Each is an ingeniously designed package of melody and groove that reveals its emotional payload only over time, as when you realize in "Teenage Dream" that Perry's insistence on "no regrets" with a new lover means she's already had a few to put behind her.

"I always try to have some heart in every song I do," said McKee, 29. "The dual-meaning thing, it's important."

Yet for all their creative and commercial success, these songs also represent a kind of professional frustration for McKee, whose dream when she left high school in Seattle wasn't to write for pop stars but to become one herself.

It almost happened that way. Signed as a teenager by Warner Bros. Records, McKee recorded a debut album, "Trouble," full of moody confessions in a post-Fiona Apple mode. The record was released in 2004 and received a bit of attention — you can still hear it on Spotify — but it stalled quickly, and soon the label dropped McKee, a "devastating" letdown that she said led to a rough stretch with drinking and drugs.

Learning how to write for other artists was her road back to stability (and a paycheck), she explained, a side gig that unexpectedly went full time.

"There are certain people who just nail what pop culture is right now," said John Ivey, program director at L.A.'s influential KIIS-FM (102.7). "Bonnie is one of them."

Bolstered by her achievements behind the scenes, McKee is making another go in front of the microphone, putting the final touches on an album of her own to be released by Epic Records early next year.

In June she put out the lead single, "American Girl," a surging electro-pop tune that's racked up more than 10 million spins on YouTube, thanks in part to a celeb-studded video featuring cameos by Perry, Adam Lambert and her old Seattle classmate Macklemore, among others.

But like most of McKee's songs, "American Girl" uses its slick veneer to deliver a more complicated message, in this case about the "emptiness and frivolousness of the American teenager," as she put it.

"I was raised by a television," McKee sings in the track, her astringent vocals multi-tracked into a chorus of Millennial screen junkies, "Every day is a competition." The result is as exuberant as it is heartbreaking.

Wearing a ripped Metallica T-shirt with her neon-bright hair swept up in a scarf à la Keith Richards, McKee was nestled beside a bank of vintage keyboards on a recent afternoon at her Silver Lake studio. Above her head hung paintings of Michael Jackson and a UFO.

This is where she's been completing her album, which McKee said contains songs she "squirreled away" while working on assignment. The material is more personal and "left of center" than her radio hits, she said, and for much of it she hooked up with other writers and producers, something she didn't really do on her first album.

"On that record she was all alone," said McKee's manager, Josh Abraham, who's also a successful writer-producer behind hits by Kelly Clarkson and Shakira. "Now she's open to collaborating and trying new styles. If a great song came in from another writer, we'd cut it. That's what an artist does."

Indeed, McKee has kept no less busy outside the studio, fully aware that in today's crowded marketplace, pop stardom is a 24/7 job of promotion and content creation. In October she released a Halloween-themed video for her song "Sleepwalker," then joined Perry later that month for a performance of "Roar" at the Hollywood Bowl.

The Top 40 radio station is one of several in the U.S. that played "American Girl," though that support wasn't enough to boost the song beyond a peak position of No. 87 on the Hot 100. (The cancellation of a Jonas Brothers tour that McKee had been set to open this fall likely didn't help.)

But Ivey said part of the reason "American Girl" faded relatively quickly was timing.

"After the early adopters took to the song, a handful of big records came out that kept it from getting on the rest of the stations," the programmer said. Among those big records? Lorde's "Royals" and, well, Katy Perry's "Roar."

Back at her studio, where her phone rarely stopped beeping, McKee chuckled at the idea. "Competing with myself," she said. "It could be worse."

TAMPA, Fla. — Another thrill ride through 18 games in the American Athletic Conference season, punctuated by the exclamation mark of a winning margin of 48.7 points, has escorted UConn to its customary early March launching pad. Yes, another undefeated league season and first seed in...

MIDDLETOWN — Witnesses told police that Andrew Olson, a Wesleyan student who was arraigned Tuesday on charges of selling a hallucinogen was involved in the distribution of the drug MDMA on campus, according to documents released after Olson appeared in court.