Appendix A: MIDI Constants

A.1 Overview

To simplify your coding, the Python Music Library defines many musical constants for you. These constants (words and abbreviations) can be used in place of numbers in your code. In many cases, each value is represented by several alternate constants (words). For example, the rhythm value 1.0 is equivalent to the constants QUARTER_NOTE and QN.

Notice that most of the constants are in upper case, which makes them easier to recognize in Python code. Python is a case-sensitive language, which means that these constants must be written using the case that appears here. Their numerical values are shown here, but you can also find them easily by typing the constants in the interpreter.

You should use these constants ...

Get Making Music with Computers 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.