(1) for to do
(2)  //memory consideration
(3)  if then
(4)   Choose a harmony from HM randomly,
(5)    // a new harmony
    // pitch adjustment
(6)   if then
(7)     // is a constant to be predetermined
(8)   end if
(9)   else
(10)    // random selection
(11)  end if
(12) end for
Algorithm 1: The procedure of improvising a new harmony.