Add memory: reuse octave/duration of last 7 notes, or pick a new one

The choice is based on weights listed in an array provided
as parameter to the new function.