Symbolism, Imagery, Allegory
It doesn't take a drum major to notice all the music in Dubliners. Lots of times, Joyce includes a song so that we get a feeling of the realistic atmosphere around Dublin as well as the emotional environment that the words of the song supply.
In "Two Gallants," our very unmusical characters stamp around town, but eventually they stroll by a street musician playing a song called "Silent, O Moyle." In the middle of Corley's endless talk, "the notes of the air throbbed deep and full" because of the harp. Readers who know the words (or look them up) can also see that this song's line, "still in her darkness doth Erin lie sleeping," gives a pretty good description of Corley and Lenehan. They aren't Irish gallants: they're Irish sleepwalkers, full of dark hopes and darker motives.
Take a look at this little Dubliners playlist, and watch how well Joyce does at timing each song for the mood of the story he's telling:
"The Lass that Loves a Sailor." Everyone except Eveline knows this is a song about how faithless sailors can be, and the fact that Frank sings it to her seems pretty uncool. It also just reveals how naïve and young Eveline can be.
"I'm a […] naughty girl." In "The Boarding House," Polly's song symbolizes her flirtatious character, which ends up getting her in trouble.
"I Dreamt that I Dwelt in Marble Halls." Maria's song in "Clay" puts words to her unspoken desire to have a better life, and it makes Joe, whom she nannied, feel guilty that she dwells in a laundromat instead.
Killarney. Madam Glynn's song in "A Mother" doesn't go over so well because she sings it in a "bodiless gasping voice" (A Mother.60). Even though everything else in that part of the fourth concert goes really well, Killarney reminds us that there's something kind of unprofessional about the whole scene, like an awkward middle school talent show.
"The Lass of Aughrim." Instead of mirroring the mood of the story, this song totally changes one character's mood. When Gretta hears Mr Bartell D'Arcy singing it, she's transported back to the time when her young love, Michael Furey, sang it to her. In this way, music in Dubliners seems capable of bringing back the dead. And that was before the iPod, too.