Now that campaigns are in full swing—from races for local sheriff to the long presidential slog—we won't be able to escape the silly season soundtrack, the music that underpins TV and radio attack ads and feel-good spots alike. You've heard it all before: the gloomy, grim, and portentous sounds meant to produce anxiety and evoke the dire catastrophe that the other candidate is threatening; and the soaring, surging anthems meant to produce positive vibes and the hopeful feeling that one's own candidate will make everything all right. But where does all that music come from?

There's a whole industry providing prefabricated incidental music for use in television shows, commercials, documentaries, and even low- and medium-budget feature films. We hear such music all the time, even when we're not aware of it. Take one of the most climactic scenes in recent television history—the moment in Breaking Bad when gangster Gus Fring walks out of a nursing home room that has just blown up. Completing the strangeness of the scene, as Fring stands for a moment in the hall, we hear some chipper elevator music. That ditty had to come from somewhere. The producers of the show didn't hire a composer to make it from scratch; instead they turned to FirstCom—one of the major players, along with De Wolfe Music and Omnimusic, in "library music"—for an off-the-shelf track, in this case a cut described as "Classic Department Store Background Styling."

As elections approach, production-music houses such as FirstCom do boffo box-office providing the music that underscores political ads. With music in a minor key for one's opponent and a major key for one's own client, production music has made it possible for political advertisers to manipulate viewers' emotions with the same tools used in filmmaking. It's a practice that has transformed the role of music in politics.

Campaign songs are nearly as old as the republic. In 1800 the Federalists sang "Adams and Liberty," and the Democratic-Republicans extolled Thomas Jefferson in the song "The Son of Liberty." But it was in 1840 that campaign music became key to victory. Not only was "Tippecanoe and Tyler Too" "sung, hummed, and bellowed on all sides," as George Templeton Strong put it, the Whigs published an entire secular hymnal of music celebrating William Henry Harrison, The Log Cabin Song Book. The Democrats whined that the Whigs had, in their emphasis on tunes, abandoned "REASON AND TRUTH" and were instead appealing through song to—gasp!—"brute passions alone." The singing of songs, they complained, had taken "the place of the calm appeal to the good judgement." General Harrison was said to have been "sung into the Presidency."

Over the decades, coming up with ditties extolling the virtues of one's candidate largely gave way to adopting the popular songs of the day. Franklin Delano Roosevelt made "Happy Days Are Here Again" his theme, as Truman did "I'm Just Wild about Harry." John F. Kennedy had "High Hopes" (though in a sort of throwback, his campaign also deployed a bespoke jingle with the don't-leave-'em-guessing lyrics "Kennedy, Kennedy, Kennedy, Kennedy, Kennedy, Kennedy, Ken-ne-dy for me!").

This year Hillary has made 2015's "Fight Song" her theme; Donald Trump has gone for a boomer mixtape of rock hits. The modern rally-song practice, it should be noted, is one that works to the benefit of Democrats because the authors and performers of popular songs—at least those outside the Nashville idiom—can be counted on to denounce Republicans who use their music. Par for the course, earlier this year the Rolling Stones ordered the Trump campaign to stop using their songs. (Trump, looking perhaps for a little sympathy for the devil, paid Mick and Keith no mind.)

But the music that really matters in politics, the stuff that is crucial to campaigning, has nothing to do with the pop anthems blared at rallies. The music that makes a difference doesn't call attention to itself and generally goes without mention. The sounds underscoring political advertisements are crucial to the emotional impact of the spots. It's a practice that has been honed in the half-century since it was pioneered.

Richard Nixon's 1968 campaign devised a new, cinematic style in campaign music (if "cinematic" is a term elastic enough to encompass low-budget horror reels). Nixon's team hired documentary filmmaker Eugene Jones to make a slew of original, riveting ads. Known as a cinéma vérité stylist, Jones's work for Nixon could be called cinéma surréalité, especially where the music was concerned. A Nixon spot on the chaotic Democratic convention begins to the tune of a pep-band playing a rah-rah version of "A Hot Time in the Old Town." Under jarring still images of rioting and violence, the happy tune is fractured and warped with psychedelic tape loops, echoing reverb, and electronic stuttering. The music is disorienting and disturbing and powerfully amplifies the anxiety the images alone would induce.

A string of Nixon ads used this new technique, which reached its zenith in an advertisement touting the former vice president as the law-and-order candidate. The ad, "The First Civil Right," presents still images of rioting, bloodied faces, tear-gas, bayonets, and burning buildings, all to unsettling music that might have come from Forbidden Planet or an episode of The Twilight Zone: A field drum rat-a-tats; an electronically altered piano splinks and splanks; a dolorous bass clarinet wails. The otherworldly music was a piece titled "Nebulae" from an experimental work called "Outer Space" composed by Vaclav Nelhybel. And in this, the Nixon team did something that would be copied by generations of political admen to come.

The Nelhybel piece wasn't commissioned for Nixon to use, nor even available on a commercial disc. It had been recorded as "off-the-shelf" incidental music that could be used by television producers and filmmakers who lacked the budgets to have music composed specifically for their projects. London's Bosworth and Company was in the library-music business, putting out discs with generic jazz, symphonic favorites, sound effects, and anything else that might be needed for an advertisement or movie soundtrack. Nelhybel's "Outer Space" was on a Bosworth Backgrounds disc called Electronic Music.

Ever since, political ad makers have been using prefab, pseudo-cinematic music to boost the emotional impact of their products.

What works—or at least what ad directors think works—changes from election cycle to election cycle. "In the mid-'80s through the early '90s, political ad music was a lot tougher, very dark and ominous," says Mac Squier. Those were the days when Squier did a lot of "politicals." Now his company, Music for Pictures, primarily produces soundtrack cues for documentaries, film, and TV. But he still keeps his hand in with election work. Squier says that these days, "People have become inured" to heavy-handed negatives, with their zombie-apocalypse cellos and glowering slasher-flick synthesizers: "The tone is now a softer negative." That means instead of monster-movie music as the default soundtrack for one's opponent, quirky comedic sounds have become standard. The other guy isn't so much scary as he is laughable, ludicrous, goofy. "Instead of being mean, you're whimsical," says Squier.

It's a style that's been honed in the last decade of reality TV. The music used on shows such as Real Housewives of Wherever is designed to make everyone on the screen look like a fool. Which is just what the political ad makers want to do to the other guy, says John Lentz, senior music director at FirstCom: "Instead of portraying the opponent as Darth Vader, there's more of an interest in making them look like bumbling idiots."

This fall, expect to hear lots of comical music designed for doofus-signaling. Much of it will come from FirstCom, which offers its political clients a whole "Satire and Exaggeration" playlist, featuring titles such as "Devious Dorks" and "HA HA HEE HEE." Typical is the tune "Looney Bin," which comes with this helpful description: "Uptempo Cartoon-Flavored Comedic; Bouncy, Goofy, Silly, Wacky, Quirky."

Which isn't to say there won't be plenty of the traditional heavy, negative orchestral treatments blanketing airwaves for the next few months. De Wolfe Music offers several CDs' worth of political production music. Their "Political World II" collection has eight tracks of music described as "Dangerous, Sinister," and 12 tracks that are "Ominous, Suspicious."

FirstCom has a playlist titled "Attack Ads & Transitions." The attack-ad part is straightforward enough—tunes such as the unsubtly titled "Now That's Evil" (tense dystopian sci-fi sounds, "Foreboding with heavy accents").

The "Transitions" part may be less obvious, but it's fundamental to the structure of the typical 30-second political TV spot. It's not enough merely to portray the opposition as evil or idiotic; the standard strategy is to offer one's own candidate as the solution to the problem, the antidote to the opponent's poisonous personality. And that means a musical transition from Negative to Positive ("NP" to use the shorthand of the biz). FirstCom has NP tracks that come with descriptions such as "Dark and glitchy piano intro transitions to uptempo, warm, positive rock. Reassuring and confident" and "Ominous piano and percussive hits and uneasy drone lead to wholesome acoustic guitar bed, light and positive with violin melody."

Sometimes there are even two transitions: An ad starts with some scene of sweetness and light, which is then threatened by a bad guy, who is in turn defeated by the good-guy candidate, who restores the aforementioned sweetness and light. This, in industry shorthand, is a "PNP"—positive, negative, positive.

These are the tricks of the trade. And now, some 50 years into the new soundscape of political advertising, we'll see whether the techniques still work or whether viewers have tired of the negatives and positives and all the transitions in-between.

As composer-producer Mac Squier says, the sort of emotion political ad music tends to elicit these days is a simple one: "Please make them stop."

Eric Felten is managing editor of The Weekly Standard and host of The Weekly Standard "Confab" podcast.