The technique of writing music that somehow reflects the literal meaning of a word or phrase (for example, ascending notes would accompany lyrics about ascending) is known as
Word painting (also known as tone painting or text painting) is the musical technique of composing music that reflects the literal meaning of a song's lyrics or story elements in programmatic music.