Paper relates to the field of information technology, in particular the content-based identification of songs. It is theoretically justified the ability to identify a piece of music by its fragment. Cluster analysis is applied when forming templates of music in the database, which reduces the amount of memory to store them. We propose the criterion for comparing the song fragment with templates database. The minimal length of the fragment is determined, which significantly reduces the computational complexity in the process of the song identifying. Experiments confirm the theoretical propositions.