Given the sentence lenght, e.g. 4 bars, analyze melody by cutting it into sentences and creating a tree out of them based on how long they match.
Start with the first sentence and make this the main branch of the tree. The second sentence is based on the first but with a different ending. The third one can be based on either first or second, etc.
To create a new sentence, find the sentence which matches the longest with it, highest number of identical notes starting from the beginning. Once they differ the new sentence should have its ending defined.
Given the sentence lenght, e.g. 4 bars, analyze melody by cutting it into sentences and creating a tree out of them based on how long they match.
Start with the first sentence and make this the main branch of the tree. The second sentence is based on the first but with a different ending. The third one can be based on either first or second, etc.
To create a new sentence, find the sentence which matches the longest with it, highest number of identical notes starting from the beginning. Once they differ the new sentence should have its ending defined.