Hello,
If this is happening for the first time in your life, then you should wait for one more week to see whether they resolve on their own on distracting yourself.
If not, or if you have previous episodes of similar symptoms, then these may be musical obsessions which is a part of OCD Obsessive compulsive disorder.
We would need to have a detailed assessment of other associated symptoms and comorbid disorders.
Next Steps
you need to consult a psychiatrist as early as you can and till then, try to distract yourself and let the music come in your mind, don't exert much to stop it, it will come and go if you don't pay much attention.