To automatically generate a template for automatic composition necessary for composing musics different in length.
The template generating device for the automatic composition supplies an existing template for the automatic composition including information relating to at least music progress and information not relating to music progress, and extracts the information not relating to the music progress from the existing supplied template for the automatic composition. In addition, in response to a condition relating to the set music progress, the information relating to the music progress is acquired from a storing means for storing a plurality of patterns of the information relating to the music progress. The information not relating to the extracted music progress and the information relating to the acquired music progress are combined to generate a new template for automatic composition corresponding to music length. Thus, the template for the automatic composition corresponding to user desired music length can be efficiently generated on the basis of the existing template for the automatic composition.