The word “voluntary” can be used for the title of a piece of music. The title was often used by English composers in the late Renaissance or Baroque periods for a piece of organ music that was free in style, i.e. it did not have to be composed in a strict form such as sonata form or a fugue. It was meant to sound as if it was being improvised (the word voluntary in general means “free”, i.e. not “forced to do something”).
Composers such as Orlando Gibbons, John Blow and Henry Purcell wrote voluntaries, although sometimes they preferred to use other titles such as fancy (an English form of the Italian word fantasia), or even fugue. However, these fugues were not composed in the proper fugue style: they just started off with imitation as in a fugue, but continued in a freer style.
Some voluntaries were called double voluntaries. These were pieces written for organs with two manuals (keyboards). The pieces contrasted a loud manual with a soft one.
Some voluntaries were known as trumpet voluntaries. These were voluntaries which had a tune which was played (with the right hand) on a stop called a “trumpet” or a “cornet”. Two very famous trumpet voluntaries, often played at weddings, are the trumpet voluntary by Henry Purcell and the one by Jeremiah Clarke (which people used to think was composed by Purcell). In the 18th century the composer John Stanley wrote many trumpet voluntaries.