Automatically creating a drone part from a given melody

If you want to automatically create a "drone part" to go with a melody (for example, for a MIDI file of bagpipe music) you can use the \dronify music function in this snippet.
This function takes two arguments, a drone pitch and a melody, and returns the melody as follows:
(1) the pitch of each note is changed to the drone pitch,
(2) ties are added between all the notes for a continuous drone sound,
(3) rests in the melody are mirrored by rests in the drone part.