Music was an important element in Shakespeare plays and poems, whether in the form of instrumental pieces, songs, or references to it. Music and song made regular appearances in Shakespeare’s plays. Music had a different function in Shakespeare’s time, and would not have been as ubiquitous as film music today. It was associated more directly with the performance on stage. Characters in the plays would hear and react to it being played.
Shakespeare usually assigned songs to servants, fools, and other minor characters in the plays. The only occasions on which the main characters would sing were if they were in disguise, or when Shakespeare wanted to show their altered mental state.
Music in the plays of William Shakespeare includes both kinds of music incidental to the plot, as song and dance. Shakespeare used vocal music to evoke mood and while doing so, to provide ironic commentary on plot or character.