A score for a book?

It occurred to me – is there a way in writing to reproduce the effect of a movie score?  For instance, the harmonica tune that floats through “Midnight Cowboy”; the movie wouldn’t be the same without that.  It doesn’t really impact the plot.  It enhances the viewer’s experience of the story.  So is there a way to achieve the same effect in a written story?  I have to think about that while I’m reading the next few books on my list.

Poems may repeat verses or rhythms.  When written well, that affects the poem’s impact on the reader.  But repeating phrases or sentences would be contrived in an essay or story.

Comedy also can effectively use repetition.  The book my MFA group is currently reading, Ex Libris by Anne Fadiman, uses this technique. In the essay “The Joy of Sesquipedalians” she repeats the word “mephitic” first in the context of it being a strange word whose definition she must learn, then repeats it in quoting someone else, then uses it (for the first time without italics) in her own voice – for a comic effect.  But it’s not really comparable to a score – no, actually it’s not at all.  It’s just repetition; repetition of a word.

Of course a score has repetitive lines or melodies (honestly I’m not even sure what the right word is, but here’s what I’m talking about in Midnight Cowboy):

It evokes sadness and isolation – especially the latter.  The person who posted this on Youtube showed the melody at two different scenes in the movie to demonstrate (presumably) how it evokes those feelings just by playing.  I mean, it’s separate from plot.  How do you reproduce that in writing?  Can it be done?