  In this paper we present a mathematical way of defining musical modes, we
derive a formula for the total number of modes and define the musicality of a
mode as the total number of harmonic chords whithin the mode. We also give an
algorithm for the construction of a duet of melodic lines given a sequence of
numbers and a mode. We attach the .mus files of the counterpoints obtained by
using the sequence of primes and several musical modes.
