8. An automatic music composing apparatus as claimed in claim 1, in which said musical segments constitute musical measures; said subsets of data include data indicative of the number of measures; said composition conditions include the number of measures; and said retrieval means includes means which, when said number of measures in the template is greater than said number of measures in the composition conditions, extracts a musical template after modifying the template under comparison with the composition conditions to have the same number of measures as the composition conditions, but when said number of measures in the template is less than said number of measures in the composition conditions, does not extract the template as a candidate.
9. An automatic music composing apparatus as claimed in claim 8, in which said retrieval means include means which, when there are more measures in the musical template than in the composition conditions, uses the last measure in the template for the measure position in the template corresponding to the last measure in the composition conditions, but when there are less measures in the musical template than in the composition conditions, said retrieval means does not extract the template as a candidate.