In the preceding iteration, we added the capability to define multiple beat patterns.
However, the beat patterns can be played only on a single script run. When the program is closed and restarted, all previous pattern data is lost.
We need a way to persist or store the beat patterns beyond a single program run. We need the ability to store values in some form of file storage and reload, play, and even edit the patterns. We need some form of object persistence.
Python provides several modules for object persistence. The module that we will use for persistence is called the pickle module. Pickle is a standard library of Python.
An object represented as a string of bytes is called a pickle in Python. Pickling, also known as object serialization, let's us convert our object into a string of bytes. The process of reconstructing the object from the string...