This article will focus on the different ways of producing music and the involved cognitive processes.
Generating music in a physical sense corresponds to generating sound i.e. propagating pressure waves in the air. This process can be divided into the following steps that occur in every kind of sound generation:
In most real situations various vibrators and resonators exist in parallel. The distinct steps can be seen in the functional principles of musical instruments as well as in speech and singing, where the lungs act as energy source, the vocal folds act as vibrator and the system of the larynx and mouth form the primary resonator.
Music production is a process that requires a wide selection of brain areas being active, especially auditory-motor interactions. Crucial for music perception are the auditory pathways, motor areas are active while singing or playing an instrument and pre-motor areas perform the planning of motor action. But also brain regions associated with emotion and memory are involved during both perception and production.
Magnetic resonance imaging studies show a strong activation in pre-motor areas especially in the Supplementary motor area (SMA) while performing music. Even when subjects only imagined singing activation as far as in primary motor areas was observed. 
- Fletcher; Neville H.; Rossing, Thomas D. (1991). The physics of musical instruments. Springer.
- Zatorre, R.J.; Chen, J.L.; Penhune, V.B.; Others, (2007). "When the brain plays music: auditory--motor interactions in music perception and production". Nature Reviews Neuroscience 8: 547-558. DOI:10.1038/nrn2152. Research Blogging.
- B. Kleber; N. Birbaumer; R. Veit; T. Trevorrow; M. Lotze (Jul 2007). "Overt and imagined singing of an Italian aria.". Neuroimage 36: 889--900. DOI:10.1016/j.neuroimage.2007.02.053. Research Blogging.