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 the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.