For this example, we'll be using a small primer from the piano score of Fur Elisa to generate melodies based on it. The primer looks like this:
Notice the time signature is 3/8. We'll be looking into this in a later section, Losing track of time.
Since you already know how to generate a sequence, we'll only provide what has changed from the previous code; you can reuse what you've written from the previous chapter. We'll be encapsulating the code in a generate function, making it easy to call with different models and configurations.