Earworm, a loan translation of the German Ohrwurm, is a portion of a song or other music that repeats compulsively within one's mind, put colloquially as "music being stuck in one's head."
The word farm comes from Proto-Germanic *firmō,*firχumō ("means of living, subsistence") and Proto-Indo-European *perkwu- ("life, strength, force").