In the first place, infinitives are not participles. However, it seems a simple adverbial to me: An inspiration might be needed to write a song.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
I, too, saw this structure identified as a dangling modifier and was perplexed, until I read more about infinitive phrases. They can function as nouns, adjectives, and adverbs:
I like to read. (direct object)
I have a job to do. (modifies "job," a noun, and is therefore an adjective phrase)
I baked a cake on Tuesday to celebrate. (modifies "baked," answering why, and