Generating a song for Fur Elisa

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.

You can follow this example in the chapter_03_example_01.py file in the source ...

Get Hands-On Music Generation with Magenta now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.