{
  "id": "task_libraries:music/python",
  "path": "/exapedia/python-music-libraries",
  "template": {
    "id": "task_libraries",
    "version": 4
  },
  "title": "Python music libraries",
  "answer": [
    {
      "t": "text",
      "text": "Python music libraries read, write, and analyze music as notes, scores, or audio. A symbolic library treats music as notes and durations rather than as the sampled sound waves that an audio library processes. These libraries let music apps, research tools, and AI models compose, transcribe, and analyze songs in code."
    }
  ],
  "breadcrumb": [
    {
      "label": "Tools"
    },
    {
      "label": "Python music libraries"
    }
  ],
  "sections": [
    {
      "id": "libraries_popularity",
      "anchor": "popularity",
      "heading": "Popularity",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Monthly downloads",
            "Stars",
            "Last release",
            "License"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#mido",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F128"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F129"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F132"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pedalboard",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F150"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#music",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F163"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F167"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pretty-midi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F181"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F185"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#symusic",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F200"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F204"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#basic-pitch",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F221"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F225"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#python-rtmidi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F241"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F245"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F243"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#essentia",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F261"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F262"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F270"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F265"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F263"
                }
              ]
            ]
          ],
          "variant": "pop",
          "caption": [
            {
              "t": "text",
              "text": "Downloads: "
            },
            {
              "t": "text",
              "text": "PyPI"
            },
            {
              "t": "text",
              "text": ", last thirty days. Stars and releases: GitHub. Amber: no release in over a year."
            }
          ]
        }
      ],
      "note": [
        {
          "t": "link",
          "href": "#mido",
          "label": [
            {
              "t": "text",
              "text": "Mido"
            }
          ]
        },
        {
          "t": "text",
          "text": " has the most monthly downloads in this comparison, at "
        },
        {
          "t": "fact",
          "fact": "F129"
        },
        {
          "t": "text",
          "text": "."
        }
      ]
    },
    {
      "id": "libraries_capabilities",
      "anchor": "capabilities",
      "heading": "Capabilities",
      "blocks": [
        {
          "b": "table",
          "columns": [
            "Library",
            "Read MIDI event model",
            "Write MIDI files",
            "Live MIDI ports"
          ],
          "rows": [
            [
              [
                {
                  "t": "link",
                  "href": "#mido",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F128"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F136"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F137"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F138"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pedalboard",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F146"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F156"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F157"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F158"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#music",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F163"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F171"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F172"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F173"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#pretty-midi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F181"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F189"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F190"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F191"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#symusic",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F200"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F210"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F211"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F212"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#basic-pitch",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F221"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F231"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F232"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F233"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#python-rtmidi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F241"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F251"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F252"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F253"
                }
              ]
            ],
            [
              [
                {
                  "t": "link",
                  "href": "#essentia",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F261"
                    }
                  ]
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F271"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F272"
                }
              ],
              [
                {
                  "t": "fact",
                  "fact": "F273"
                }
              ]
            ]
          ],
          "variant": "cap"
        }
      ]
    },
    {
      "id": "libraries_entries",
      "anchor": "libraries",
      "heading": "Libraries",
      "blocks": [
        {
          "b": "entry",
          "anchor": "mido",
          "name": [
            {
              "t": "fact",
              "fact": "F128"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/mido/mido"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/mido"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/mido/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F11"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F129"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F135"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F131"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F130"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/mido/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F128"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F12"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F13"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F14"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F15"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F16"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F17"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F18"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F19"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F144"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F145"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/craffel/pretty-midi",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F144"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def write(self, filename, round_tempo=False):\n    \"\"\"Write the MIDI data out to a .mid file.\n\n    Parameters\n    ----------\n    filename : str or file\n        Path or file to write .mid file to.\n    round_tempo : bool\n        If True, round MIDI tempos to the nearest integer microsecond per\n        quarter note. If False, truncate them for backwards compatibility.\n        Default is False.\n\n    \"\"\"\n\n    def event_compare(event1, event2):\n        \"\"\"Compares two events for sorting.\n\n        Events are sorted by tick time ascending. Events with the same tick\n        time ares sorted by event type. Some events are sorted by\n        additional values. For example, Note On events are sorted by pitch\n        then velocity, ensuring that a Note Off (Note On with velocity 0)\n        will never follow a Note On with the same pitch.\n\n        Parameters\n        ----------\n        event1, event2 : mido.Message\n           Two events to be compared.\n        \"\"\"\n        # Construct a dictionary which will map event names to numeric\n        # values which produce the correct sorting.  Each dictionary value\n        # is a function which accepts an event and returns a score.\n        # The spacing for these scores is 256, which is larger than the\n        # largest value a MIDI value can take.\n        secondary_sort = {\n            'set_tempo': lambda e: (1 * 256 * 256),\n            'time_signature': lambda e: (2 * 256 * 256),\n            'key_signature': lambda e: (3 * 256 * 256),\n            'lyrics': lambda e: (4 * 256 * 256),\n            'text_events' :lambda e: (5 * 256 * 256),\n            'program_change': lambda e: (6 * 256 * 256),\n            'pitchwheel': lambda e: ((7 * 256 * 256) + e.pitch),\n            'control_change': lambda e: (\n                (8 * 256 * 256) + (e.control * 256) + e.value),\n            'note_off': lambda e: ((9 * 256 * 256) + (e.note * 256)),\n            'note_on': lambda e: (\n                (10 * 256 * 256) + (e.note * 256) + e.velocity),\n            'end_of_track': lambda e: (11 * 256 * 256)\n        }\n        # If the events have the same tick, and both events have types\n        # which appear in the secondary_sort dictionary, use the dictionary\n        # to determine their ordering.\n        if (event1.time == event2.time and\n                event1.type in secondary_sort and\n                event2.type in secondary_sort):\n            return (secondary_sort[event1.type](event1) -\n                    secondary_sort[event2.type](event2))\n        # Otherwise, just return the difference of their ticks.\n        return event1.time - event2.time\n\n    # Initialize output MIDI object\n    mid = mido.MidiFile(ticks_per_beat=self.resolution, charset=self._charset)\n    # Create track 0 with timing information\n    timing_track = mido.MidiTrack()\n    # Add a default time signature only if there is not one at time 0.\n    add_ts = True\n    if self.time_signature_changes:\n        add_ts = min([ts.time for ts in self.time_signature_changes]) > 0.0\n    if add_ts:\n        # Add time signature event with default values (4/4)\n        timing_track.append(mido.MetaMessage(\n            'time_signature', time=0, numerator=4, denominator=4))\n\n    # Add in each tempo change event\n    for (tick, tick_scale) in self._tick_scales:\n        # Convert seconds per tick to microseconds per quarter note\n        tempo = (mido.bpm2tempo(60./(tick_scale*self.resolution))\n                 if round_tempo else int(6e7/(60./(tick_scale*self.resolution))))\n        timing_track.append(mido.MetaMessage(\n            'set_tempo', time=tick, tempo=tempo))\n    # Add in each time signature\n    for ts in self.time_signature_changes:\n        timing_track.append(mido.MetaMessage(\n            'time_signature', time=self.time_to_tick(ts.time),\n            numerator=ts.numerator, denominator=ts.denominator))\n    # Add in each key signature\n    # Mido accepts key changes in a different format than pretty_midi, this\n    # list maps key number to mido key name\n    key_number_to_mido_key_name = [\n        'C', 'Db', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B',\n        'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am',\n        'Bbm', 'Bm']\n    for ks in self.key_signature_changes:\n        timing_track.append(mido.MetaMessage(\n            'key_signature', time=self.time_to_tick(ks.time),\n            key=key_number_to_mido_key_name[ks.key_number]))\n    # Add in all lyrics events\n    for l in self.lyrics:\n        timing_track.append(mido.MetaMessage(\n            'lyrics', time=self.time_to_tick(l.time), text=l.text))\n    # Add text events\n    for l in self.text_events:\n        timing_track.append(mido.MetaMessage(\n            'text', time=self.time_to_tick(l.time), text=l.text))\n    # Sort the (absolute-tick-timed) events.\n    timing_track.sort(key=functools.cmp_to_key(event_compare))\n    # Add in an end of track event\n    timing_track.append(mido.MetaMessage(\n        'end_of_track', time=timing_track[-1].time + 1))\n    mid.tracks.append(timing_track)\n    # Create a list of possible channels to assign - this seems to matter\n    # for some synths.\n    channels = list(range(16))\n    # Don't assign the drum channel by mistake!\n    channels.remove(9)\n    for n, instrument in enumerate(self.instruments):\n        # Initialize track for this instrument\n        track = mido.MidiTrack()\n        # Add track name event if instrument has a name\n        if instrument.name:\n            track.append(mido.MetaMessage(\n                'track_name', time=0, name=instrument.name))\n        # If it's a drum event, we need to set channel to 9\n        if instrument.is_drum:\n            channel = 9\n        # Otherwise, choose a channel from the possible channel list\n        else:\n            channel = channels[n % len(channels)]\n        # Set the program number\n        track.append(mido.Message(\n            'program_change', time=0, program=instrument.program,\n            channel=channel))\n        # Add all note events\n        for note in instrument.notes:\n            # Construct the note-on event\n            track.append(mido.Message(\n                'note_on', time=self.time_to_tick(note.start),\n                channel=channel, note=note.pitch, velocity=note.velocity))\n            # Also need a note-off event (note on with velocity 0)\n            track.append(mido.Message(\n                'note_on', time=self.time_to_tick(note.end),\n                channel=channel, note=note.pitch, velocity=0))\n        # Add all pitch bend events\n        for bend in instrument.pitch_bends:\n            track.append(mido.Message(\n                'pitchwheel', time=self.time_to_tick(bend.time),\n                channel=channel, pitch=bend.pitch))\n        # Add all control change events\n        for control_change in instrument.control_changes:\n            track.append(mido.Message(\n                'control_change',\n                time=self.time_to_tick(control_change.time),\n                channel=channel, control=control_change.number,\n                value=control_change.value))\n        # Sort all the events using the event_compare comparator.\n        track = sorted(track, key=functools.cmp_to_key(event_compare))\n\n        # If there's a note off event and a note on event with the same\n        # tick and pitch, put the note off event first\n        for n, (event1, event2) in enumerate(zip(track[:-1], track[1:])):\n            if (event1.time == event2.time and\n                    event1.type == 'note_on' and\n                    event2.type == 'note_on' and\n                    event1.note == event2.note and\n                    event1.velocity != 0 and\n                    event2.velocity == 0):\n                track[n] = event2\n                track[n + 1] = event1\n        # Finally, add in an end of track event\n        track.append(mido.MetaMessage(\n            'end_of_track', time=track[-1].time + 1))\n        # Add to the list of output tracks\n        mid.tracks.append(track)\n    # Turn ticks to relative time from absolute\n    for track in mid.tracks:\n        tick = 0\n        for event in track:\n            event.time -= tick\n            tick += event.time\n    # Write it out\n    if isinstance(filename, six.string_types) or isinstance(filename, pathlib.PurePath):\n        # If a string or path was given, pass it as the filename\n        mid.save(filename=filename)\n    else:\n        # Otherwise, try passing it in as a file pointer\n        mid.save(file=filename)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/craffel/pretty-midi/blob/0df351ff2949ef80e788343e952fe15e473f0cde/pretty_midi/pretty_midi.py#L1398-L1582",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F143"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20mido%20for%20MIDI%20serialization%2C%20score%20parsing%20and%20note-event%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F128"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import mido\nmessage = mido.Message('note_on', note=60, velocity=64)\nprint(message)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://mido.readthedocs.io/en/stable/messages/",
                  "label": [
                    {
                      "t": "text",
                      "text": "midi.html"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F133"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pedalboard",
          "name": [
            {
              "t": "fact",
              "fact": "F146"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/spotify/pedalboard"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/pedalboard"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/pedalboard/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F153"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F147"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F155"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F149"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F148"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/pedalboard/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F146"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from pedalboard import load_plugin\nfrom mido import Message\ninstrument = load_plugin('your-instrument.vst3')\naudio = instrument(\n    [Message('note_on', note=60), Message('note_off', note=60, time=5)],\n    duration=5, sample_rate=44100,\n)\nprint(audio.shape)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://spotify.github.io/pedalboard/examples.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "examples.rst"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=pedalboard%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F146"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F151"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "music",
          "name": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/cuthbertLab/music21"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/music21"
            },
            {
              "label": "Docs",
              "href": "https://www.music21.org/music21docs/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F36"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F164"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F170"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F166"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F165"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://www.music21.org/music21docs/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F163"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F37"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F38"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F39"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F40"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F41"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F42"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F179"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F180"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/MusicLang/musiclang",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F179"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def _m21Parse(f, fmt=None, remove_perc=True):\n    \"\"\"\n\n    Parameters\n    ----------\n    f :\n\n    fmt :\n         (Default value = None)\n\n    Returns\n    -------\n\n    \"\"\"\n    import music21\n    s = music21.converter.parse(f, format=fmt, forceSource=True)\n    if remove_perc:\n\n        for el in s.recurse():\n            if set(el.classes).intersection(['PercussionChord', 'Unpitched']):  # or 'Piano'\n                # el.activeSite.replace(el, instrument.Violin())\n                el.activeSite.remove(el)\n\n        # perc = [\n        #     p\n        #     for p in s.parts\n        #     if list(p.recurse().getElementsByClass([\"PercussionClef\", \"PercussionChord\"]))\n        # ]\n        # s.remove(perc, recurse=True)\n    return s",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/MusicLang/musiclang/blob/6d1f4afc88cdbc7be3635862cafd980e41e77f67/musiclang/analyze/parser.py#L640-L669",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F178"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20music21%20for%20MIDI%20serialization%2C%20score%20parsing%20and%20note-event%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F163"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from music21 import note\nn = note.Note('C4')\nprint(n)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://www.music21.org/music21docs/moduleReference/moduleNote.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F168"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "pretty-midi",
          "name": [
            {
              "t": "fact",
              "fact": "F181"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/craffel/pretty-midi"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/pretty-midi"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/pretty-midi/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F60"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F182"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F188"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F184"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F183"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/pretty-midi/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F181"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F61"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F62"
                }
              ]
            },
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F63"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F64"
                }
              ]
            }
          ],
          "cons": [
            {
              "lead": [
                {
                  "t": "fact",
                  "fact": "F65"
                }
              ],
              "body": [
                {
                  "t": "fact",
                  "fact": "F66"
                }
              ]
            }
          ],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F198"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F199"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/magenta/note-seq",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F198"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def midi_to_note_sequence(midi_data):\n  \"\"\"Convert MIDI file contents to a NoteSequence.\n\n  Converts a MIDI file encoded as a string into a NoteSequence. Decoding errors\n  are very common when working with large sets of MIDI files, so be sure to\n  handle MIDIConversionError exceptions.\n\n  Args:\n    midi_data: A string containing the contents of a MIDI file or populated\n        pretty_midi.PrettyMIDI object.\n\n  Returns:\n    A NoteSequence.\n\n  Raises:\n    MIDIConversionError: An improper MIDI mode was supplied.\n  \"\"\"\n  # In practice many MIDI files cannot be decoded with pretty_midi. Catch all\n  # errors here and try to log a meaningful message. So many different\n  # exceptions are raised in pretty_midi.PrettyMidi that it is cumbersome to\n  # catch them all only for the purpose of error logging.\n  # pylint: disable=bare-except\n  if isinstance(midi_data, pretty_midi.PrettyMIDI):\n    midi = midi_data\n  else:\n    try:\n      midi = pretty_midi.PrettyMIDI(io.BytesIO(midi_data))\n    except:\n      raise MIDIConversionError('Midi decoding error %s: %s' %\n                                (sys.exc_info()[0], sys.exc_info()[1]))\n  # pylint: enable=bare-except\n\n  sequence = music_pb2.NoteSequence()\n\n  # Populate header.\n  sequence.ticks_per_quarter = midi.resolution\n  sequence.source_info.parser = music_pb2.NoteSequence.SourceInfo.PRETTY_MIDI\n  sequence.source_info.encoding_type = (\n      music_pb2.NoteSequence.SourceInfo.MIDI)\n\n  # Populate time signatures.\n  for midi_time in midi.time_signature_changes:\n    time_signature = sequence.time_signatures.add()\n    time_signature.time = midi_time.time\n    time_signature.numerator = midi_time.numerator\n    try:\n      # Denominator can be too large for int32.\n      time_signature.denominator = midi_time.denominator\n    except ValueError:\n      raise MIDIConversionError('Invalid time signature denominator %d' %\n                                midi_time.denominator)\n\n  # Populate key signatures.\n  for midi_key in midi.key_signature_changes:\n    key_signature = sequence.key_signatures.add()\n    key_signature.time = midi_key.time\n    key_signature.key = midi_key.key_number % 12\n    midi_mode = midi_key.key_number // 12\n    if midi_mode == 0:\n      key_signature.mode = key_signature.MAJOR\n    elif midi_mode == 1:\n      key_signature.mode = key_signature.MINOR\n    else:\n      raise MIDIConversionError('Invalid midi_mode %i' % midi_mode)\n\n  # Populate tempo changes.\n  tempo_times, tempo_qpms = midi.get_tempo_changes()\n  for time_in_seconds, tempo_in_qpm in zip(tempo_times, tempo_qpms):\n    tempo = sequence.tempos.add()\n    tempo.time = time_in_seconds\n    tempo.qpm = tempo_in_qpm\n\n  # Populate notes by gathering them all from the midi's instruments.\n  # Also set the sequence.total_time as the max end time in the notes.\n  midi_notes = []\n  midi_pitch_bends = []\n  midi_control_changes = []\n  for num_instrument, midi_instrument in enumerate(midi.instruments):\n    # Populate instrument name from the midi's instruments\n    if midi_instrument.name:\n      instrument_info = sequence.instrument_infos.add()\n      instrument_info.name = midi_instrument.name\n      instrument_info.instrument = num_instrument\n    for midi_note in midi_instrument.notes:\n      if not sequence.total_time or midi_note.end > sequence.total_time:\n        sequence.total_time = midi_note.end\n      midi_notes.append((midi_instrument.program, num_instrument,\n                         midi_instrument.is_drum, midi_note))\n    for midi_pitch_bend in midi_instrument.pitch_bends:\n      midi_pitch_bends.append(\n          (midi_instrument.program, num_instrument,\n           midi_instrument.is_drum, midi_pitch_bend))\n    for midi_control_change in midi_instrument.control_changes:\n      midi_control_changes.append(\n          (midi_instrument.program, num_instrument,\n           midi_instrument.is_drum, midi_control_change))\n\n  for program, instrument, is_drum, midi_note in midi_notes:\n    note = sequence.notes.add()\n    note.instrument = instrument\n    note.program = program\n    note.start_time = midi_note.start\n    note.end_time = midi_note.end\n    note.pitch = midi_note.pitch\n    note.velocity = midi_note.velocity\n    note.is_drum = is_drum\n\n  for program, instrument, is_drum, midi_pitch_bend in midi_pitch_bends:\n    pitch_bend = sequence.pitch_bends.add()\n    pitch_bend.instrument = instrument\n    pitch_bend.program = program\n    pitch_bend.time = midi_pitch_bend.time\n    pitch_bend.bend = midi_pitch_bend.pitch\n    pitch_bend.is_drum = is_drum\n\n  for program, instrument, is_drum, midi_control_change in midi_control_changes:\n    control_change = sequence.control_changes.add()\n    control_change.instrument = instrument\n    control_change.program = program\n    control_change.time = midi_control_change.time\n    control_change.control_number = midi_control_change.number\n    control_change.control_value = midi_control_change.value\n    control_change.is_drum = is_drum\n\n  # TODO(douglaseck): Estimate note type (e.g. quarter note) and populate\n  # note.numerator and note.denominator.\n\n  return sequence",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/magenta/note-seq/blob/35825508885343fb06f93dc87ff491dbbf034505/note_seq/midi_io.py#L43-L170",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F197"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=Python%20projects%20using%20pretty-midi%20for%20MIDI%20serialization%2C%20score%20parsing%20and%20note-event%20conversion&filters=%7B%22type%22%3A%20%22auto%22%2C%20%22numResults%22%3A%2010%2C%20%22includeDomains%22%3A%20%5B%22github.com%22%5D%7D",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F181"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import pretty_midi\nmidi = pretty_midi.PrettyMIDI('example.mid')\nprint(midi.get_end_time())\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/craffel/pretty-midi/blob/0df351ff2949ef80e788343e952fe15e473f0cde/pretty_midi/pretty_midi.py",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F186"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "symusic",
          "name": [
            {
              "t": "fact",
              "fact": "F200"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/Yikai-Liao/symusic"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/symusic"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/symusic/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F207"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F201"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F209"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F203"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F202"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/symusic/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F200"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F219"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F220"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/Natooz/MidiTok",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F219"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def split_score_per_tracks(score: Score) -> list[Score]:\n    \"\"\"\n    Split a ``symusic.Score`` into several scores for each of its tracks.\n\n    The split scores will all start at tick 0.\n    Example: for a score with an end tick at 1000, and a list of tick\n    ``[2000, 5000, 7000]``, this method will return a list of four scores which\n    correspond respectively to the portions of the original score from tick 0 to 2000,\n    2000 to 5000, 5000 to 7000 and 10000 to 10000.\n\n    :param score: ``symusic.Score`` object to split.\n    :return: a list of split ``symusic.Score`` objects.\n    \"\"\"\n    scores_split = []\n    for track in score.tracks:\n        score_split = Score(score.tpq)\n        score_split.tempos = score.tempos\n        score_split.time_signatures = score.time_signatures\n        score_split.key_signatures = score.key_signatures\n        score_split.markers = score.markers\n        score_split.tracks.append(track.copy())\n\n        scores_split.append(score_split)\n    return scores_split",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/Natooz/MidiTok/blob/680b5a4ec1b2ebd2e55f229ffcfce7f4770a2411/src/miditok/utils/split.py#L563-L586",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F218"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=symusic%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F200"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from symusic import Score\nscore = Score('example.mid')\nprint(score.tpq)\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://pypi.org/pypi/symusic/0.6.0/json#info.description",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F205"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "basic-pitch",
          "name": [
            {
              "t": "fact",
              "fact": "F221"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/spotify/basic-pitch"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/basic-pitch"
            },
            {
              "label": "Docs",
              "href": "https://pypi.org/project/basic-pitch/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F228"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F222"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F230"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F224"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F223"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://pypi.org/project/basic-pitch/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F221"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F239"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F240"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/samim23/polymath",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F239"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def extractMIDI(audio_paths, output_dir):\n    print('- Extract Midi')\n    save_midi = True\n    sonify_midi = False\n    save_model_outputs = False\n    save_notes = False\n\n    predict_and_save(audio_path_list=audio_paths, \n                  output_directory=output_dir, \n                  save_midi=save_midi, \n                  sonify_midi=sonify_midi, \n                  save_model_outputs=save_model_outputs, \n                  save_notes=save_notes)",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/samim23/polymath/blob/49e56436ae8127105f4195dd83b39f7093430e27/polymath.py#L333-L345",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F238"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=basic-pitch%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F221"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "from basic_pitch.inference import predict\nmodel_output, midi_data, note_events = predict('example.wav')\nprint(len(note_events))\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://github.com/spotify/basic-pitch/blob/9991303bba609a3b93089d13ec80d1d495083596/basic_pitch/inference.py",
                  "label": [
                    {
                      "t": "text",
                      "text": "inference.py"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F226"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "python-rtmidi",
          "name": [
            {
              "t": "fact",
              "fact": "F241"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/SpotlightKid/python-rtmidi"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/python-rtmidi"
            },
            {
              "label": "Docs",
              "href": "https://spotlightkid.github.io/python-rtmidi/"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F248"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F242"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F250"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F244"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F243"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "https://spotlightkid.github.io/python-rtmidi/",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F241"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "fact",
                  "fact": "F259"
                }
              ],
              "stars": [
                {
                  "t": "fact",
                  "fact": "F260"
                }
              ],
              "usedBy": [
                {
                  "t": "link",
                  "href": "https://github.com/mido/mido",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F259"
                    }
                  ]
                },
                {
                  "t": "text",
                  "text": " "
                }
              ],
              "language": "python",
              "code": "def get_devices(api=None, **kwargs):\n    devices = {}\n\n    rtapi = _get_api_id(api)\n\n    mi = rtmidi.MidiIn(rtapi=rtapi)\n    mo = rtmidi.MidiOut(rtapi=rtapi)\n    input_names = mi.get_ports()\n    output_names = mo.get_ports()\n\n    for name in input_names + output_names:\n        if name not in devices:\n            devices[name] = {\n                'name': name,\n                'is_input': name in input_names,\n                'is_output': name in output_names,\n            }\n\n    mi.delete()\n    mo.delete()\n    return list(devices.values())",
              "prov": [
                {
                  "t": "link",
                  "href": "https://github.com/mido/mido/blob/d261ee41db32717fb73dfaa14162159fb6529ef5/mido/backends/rtmidi.py#L51-L71",
                  "label": [
                    {
                      "t": "fact",
                      "fact": "F258"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=python-rtmidi%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "More projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F241"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            },
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import rtmidi\nmidiout = rtmidi.MidiOut()\ntry:\n    print(midiout.get_ports())\nfinally:\n    midiout.delete()\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://spotlightkid.github.io/python-rtmidi/rtmidi.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "rtmidi.rst"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F246"
            }
          ]
        },
        {
          "b": "entry",
          "anchor": "essentia",
          "name": [
            {
              "t": "fact",
              "fact": "F261"
            }
          ],
          "links": [
            {
              "label": "GitHub",
              "href": "https://github.com/MTG/essentia"
            },
            {
              "label": "PyPI",
              "href": "https://pypi.org/project/essentia"
            },
            {
              "label": "Docs",
              "href": "http://essentia.upf.edu"
            }
          ],
          "what": [
            {
              "t": "fact",
              "fact": "F268"
            }
          ],
          "facts": [
            {
              "label": "Downloads / mo",
              "value": [
                {
                  "t": "fact",
                  "fact": "F262"
                }
              ]
            },
            {
              "label": "Stars",
              "value": [
                {
                  "t": "fact",
                  "fact": "F270"
                }
              ]
            },
            {
              "label": "Last release",
              "value": [
                {
                  "t": "fact",
                  "fact": "F264"
                }
              ]
            },
            {
              "label": "License",
              "value": [
                {
                  "t": "fact",
                  "fact": "F263"
                }
              ]
            },
            {
              "label": "Capabilities",
              "value": [
                {
                  "t": "link",
                  "href": "http://essentia.upf.edu",
                  "label": [
                    {
                      "t": "text",
                      "text": "From the "
                    },
                    {
                      "t": "fact",
                      "fact": "F261"
                    },
                    {
                      "t": "text",
                      "text": " docs"
                    }
                  ]
                }
              ]
            }
          ],
          "pros": [],
          "cons": [],
          "tabs": [
            {
              "label": [
                {
                  "t": "text",
                  "text": "Quickstart"
                }
              ],
              "language": "python",
              "code": "import numpy as np\nfrom essentia.standard import Audio2Midi\ndetector = Audio2Midi(hopSize=32)\nresult = detector(np.zeros(32, dtype=np.float32))\nprint(result[2:])\n",
              "prov": [
                {
                  "t": "text",
                  "text": "From "
                },
                {
                  "t": "link",
                  "href": "https://essentia.upf.edu/reference/std_Audio2Midi.html",
                  "label": [
                    {
                      "t": "text",
                      "text": "README.md"
                    }
                  ]
                }
              ],
              "more": [
                {
                  "t": "link",
                  "href": "https://dashboard.exa.ai/playground/search?q=essentia%20GitHub%20projects",
                  "label": [
                    {
                      "t": "text",
                      "text": "Find projects using "
                    },
                    {
                      "t": "fact",
                      "fact": "F261"
                    },
                    {
                      "t": "text",
                      "text": " →"
                    }
                  ]
                }
              ]
            }
          ],
          "install": [
            {
              "t": "fact",
              "fact": "F266"
            }
          ]
        }
      ]
    }
  ],
  "questions": [
    {
      "q": "Which Python music library should I use?",
      "a": [
        {
          "t": "link",
          "href": "#mido",
          "label": [
            {
              "t": "text",
              "text": "Mido"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits MIDI messages and files. "
        },
        {
          "t": "link",
          "href": "#music",
          "label": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits score analysis with notation, parts, and durations. "
        },
        {
          "t": "link",
          "href": "#pedalboard",
          "label": [
            {
              "t": "text",
              "text": "Pedalboard"
            }
          ]
        },
        {
          "t": "text",
          "text": " suits audio effects and rendering instrument plugins."
        }
      ]
    },
    {
      "q": "What is Basic Pitch?",
      "a": [
        {
          "t": "link",
          "href": "#basic-pitch",
          "label": [
            {
              "t": "text",
              "text": "Basic Pitch"
            }
          ]
        },
        {
          "t": "text",
          "text": " converts audio recordings to MIDI and detects pitch bends. Its maintainers recommend it for one instrument at a time."
        }
      ]
    },
    {
      "q": "What is music21?",
      "a": [
        {
          "t": "link",
          "href": "#music",
          "label": [
            {
              "t": "fact",
              "fact": "F163"
            }
          ]
        },
        {
          "t": "text",
          "text": " is a toolkit for computer-aided music analysis that represents music as scores, parts, and streams. It reads MusicXML, MIDI, and other symbolic formats."
        }
      ]
    },
    {
      "q": "How do I make music with Python?",
      "a": [
        {
          "t": "link",
          "href": "#pedalboard",
          "label": [
            {
              "t": "text",
              "text": "Pedalboard"
            }
          ]
        },
        {
          "t": "text",
          "text": " adds effects to audio and renders sound from installed instrument plugins. "
        },
        {
          "t": "link",
          "href": "#symusic",
          "label": [
            {
              "t": "text",
              "text": "Symusic"
            }
          ]
        },
        {
          "t": "text",
          "text": " synthesizes MIDI through SoundFont files."
        }
      ]
    }
  ],
  "facts": {
    "F1": {
      "label": "Library name, mido",
      "display": "Mido",
      "asOf": "2026-11-17"
    },
    "F2": {
      "label": "Monthly downloads, mido",
      "display": "1.4M",
      "asOf": "2026-11-16"
    },
    "F3": {
      "label": "License, mido",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F4": {
      "label": "Package release, mido",
      "display": "1.3.3, Oct 2024",
      "asOf": "2024-10-25"
    },
    "F5": {
      "label": "Package release date, mido",
      "display": "Oct 2024",
      "asOf": "2024-10-25"
    },
    "F6": {
      "label": "Repository stars, mido",
      "display": "1.7K",
      "asOf": "2026-11-17"
    },
    "F7": {
      "label": "Reads MIDI files, mido",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F8": {
      "label": "Writes MIDI files, mido",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F9": {
      "label": "Output formats, mido",
      "display": "MIDI",
      "asOf": "2026-11-17"
    },
    "F10": {
      "label": "Install, mido",
      "display": "pip install mido",
      "asOf": "2026-11-17"
    },
    "F11": {
      "label": "What it does, mido",
      "display": "Provides MIDI message objects, file handling, and APIs for MIDI ports.",
      "asOf": "2026-11-17"
    },
    "F12": {
      "label": "strengths lead, mido",
      "display": "Edits individual MIDI messages",
      "asOf": "2026-11-17"
    },
    "F13": {
      "label": "strengths, mido",
      "display": "Read, change, and save messages within MIDI tracks.",
      "asOf": "2026-11-17"
    },
    "F14": {
      "label": "strengths lead, mido",
      "display": "Connects to live MIDI ports",
      "asOf": "2026-11-17"
    },
    "F15": {
      "label": "strengths, mido",
      "display": "Use input and output ports through the selected backend.",
      "asOf": "2026-11-17"
    },
    "F16": {
      "label": "limitations lead, mido",
      "display": "Hardware ports need a backend",
      "asOf": "2026-11-17"
    },
    "F17": {
      "label": "limitations, mido",
      "display": "Install a supported backend before opening physical MIDI ports.",
      "asOf": "2026-11-17"
    },
    "F18": {
      "label": "limitations lead, mido",
      "display": "Track times use delta ticks",
      "asOf": "2026-11-17"
    },
    "F19": {
      "label": "limitations, mido",
      "display": "Convert absolute event positions into delta ticks when building MIDI tracks.",
      "asOf": "2026-11-17"
    },
    "F20": {
      "label": "Quickstart, mido",
      "display": "from mido import Message, MidiFile, MidiTrack\n\nmid = MidiFile()\ntrack = MidiTrack()\nmid.tracks.append(track)\n\ntrack.append(Message('program_change', program=12, time=0))\ntrack.append(Message('note_on', note=64, velocity=64, time=32))\ntrack.append(Message('note_off', note=64, velocity=127, time=32))\n\nmid.save('new_song.mid')\n\n",
      "asOf": "2026-11-17"
    },
    "F21": {
      "label": "Project function, mido",
      "display": "def write(self, filename, round_tempo=False):\n    \"\"\"Write the MIDI data out to a .mid file.\n\n    Parameters\n    ----------\n    filename : str or file\n        Path or file to write .mid file to.\n    round_tempo : bool\n        If True, round MIDI tempos to the nearest integer microsecond per\n        quarter note. If False, truncate them for backwards compatibility.\n        Default is False.\n\n    \"\"\"\n\n    def event_compare(event1, event2):\n        \"\"\"Compares two events for sorting.\n\n        Events are sorted by tick time ascending. Events with the same tick\n        time ares sorted by event type. Some events are sorted by\n        additional values. For example, Note On events are sorted by pitch\n        then velocity, ensuring that a Note Off (Note On with velocity 0)\n        will never follow a Note On with the same pitch.\n\n        Parameters\n        ----------\n        event1, event2 : mido.Message\n           Two events to be compared.\n        \"\"\"\n        # Construct a dictionary which will map event names to numeric\n        # values which produce the correct sorting.  Each dictionary value\n        # is a function which accepts an event and returns a score.\n        # The spacing for these scores is 256, which is larger than the\n        # largest value a MIDI value can take.\n        secondary_sort = {\n            'set_tempo': lambda e: (1 * 256 * 256),\n            'time_signature': lambda e: (2 * 256 * 256),\n            'key_signature': lambda e: (3 * 256 * 256),\n            'lyrics': lambda e: (4 * 256 * 256),\n            'text_events' :lambda e: (5 * 256 * 256),\n            'program_change': lambda e: (6 * 256 * 256),\n            'pitchwheel': lambda e: ((7 * 256 * 256) + e.pitch),\n            'control_change': lambda e: (\n                (8 * 256 * 256) + (e.control * 256) + e.value),\n            'note_off': lambda e: ((9 * 256 * 256) + (e.note * 256)),\n            'note_on': lambda e: (\n                (10 * 256 * 256) + (e.note * 256) + e.velocity),\n            'end_of_track': lambda e: (11 * 256 * 256)\n        }\n        # If the events have the same tick, and both events have types\n        # which appear in the secondary_sort dictionary, use the dictionary\n        # to determine their ordering.\n        if (event1.time == event2.time and\n                event1.type in secondary_sort and\n                event2.type in secondary_sort):\n            return (secondary_sort[event1.type](event1) -\n                    secondary_sort[event2.type](event2))\n        # Otherwise, just return the difference of their ticks.\n        return event1.time - event2.time\n\n    # Initialize output MIDI object\n    mid = mido.MidiFile(ticks_per_beat=self.resolution, charset=self._charset)\n    # Create track 0 with timing information\n    timing_track = mido.MidiTrack()\n    # Add a default time signature only if there is not one at time 0.\n    add_ts = True\n    if self.time_signature_changes:\n        add_ts = min([ts.time for ts in self.time_signature_changes]) > 0.0\n    if add_ts:\n        # Add time signature event with default values (4/4)\n        timing_track.append(mido.MetaMessage(\n            'time_signature', time=0, numerator=4, denominator=4))\n\n    # Add in each tempo change event\n    for (tick, tick_scale) in self._tick_scales:\n        # Convert seconds per tick to microseconds per quarter note\n        tempo = (mido.bpm2tempo(60./(tick_scale*self.resolution))\n                 if round_tempo else int(6e7/(60./(tick_scale*self.resolution))))\n        timing_track.append(mido.MetaMessage(\n            'set_tempo', time=tick, tempo=tempo))\n    # Add in each time signature\n    for ts in self.time_signature_changes:\n        timing_track.append(mido.MetaMessage(\n            'time_signature', time=self.time_to_tick(ts.time),\n            numerator=ts.numerator, denominator=ts.denominator))\n    # Add in each key signature\n    # Mido accepts key changes in a different format than pretty_midi, this\n    # list maps key number to mido key name\n    key_number_to_mido_key_name = [\n        'C', 'Db', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B',\n        'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am',\n        'Bbm', 'Bm']\n    for ks in self.key_signature_changes:\n        timing_track.append(mido.MetaMessage(\n            'key_signature', time=self.time_to_tick(ks.time),\n            key=key_number_to_mido_key_name[ks.key_number]))\n    # Add in all lyrics events\n    for l in self.lyrics:\n        timing_track.append(mido.MetaMessage(\n            'lyrics', time=self.time_to_tick(l.time), text=l.text))\n    # Add text events\n    for l in self.text_events:\n        timing_track.append(mido.MetaMessage(\n            'text', time=self.time_to_tick(l.time), text=l.text))\n    # Sort the (absolute-tick-timed) events.\n    timing_track.sort(key=functools.cmp_to_key(event_compare))\n    # Add in an end of track event\n    timing_track.append(mido.MetaMessage(\n        'end_of_track', time=timing_track[-1].time + 1))\n    mid.tracks.append(timing_track)\n    # Create a list of possible channels to assign - this seems to matter\n    # for some synths.\n    channels = list(range(16))\n    # Don't assign the drum channel by mistake!\n    channels.remove(9)\n    for n, instrument in enumerate(self.instruments):\n        # Initialize track for this instrument\n        track = mido.MidiTrack()\n        # Add track name event if instrument has a name\n        if instrument.name:\n            track.append(mido.MetaMessage(\n                'track_name', time=0, name=instrument.name))\n        # If it's a drum event, we need to set channel to 9\n        if instrument.is_drum:\n            channel = 9\n        # Otherwise, choose a channel from the possible channel list\n        else:\n            channel = channels[n % len(channels)]\n        # Set the program number\n        track.append(mido.Message(\n            'program_change', time=0, program=instrument.program,\n            channel=channel))\n        # Add all note events\n        for note in instrument.notes:\n            # Construct the note-on event\n            track.append(mido.Message(\n                'note_on', time=self.time_to_tick(note.start),\n                channel=channel, note=note.pitch, velocity=note.velocity))\n            # Also need a note-off event (note on with velocity 0)\n            track.append(mido.Message(\n                'note_on', time=self.time_to_tick(note.end),\n                channel=channel, note=note.pitch, velocity=0))\n        # Add all pitch bend events\n        for bend in instrument.pitch_bends:\n            track.append(mido.Message(\n                'pitchwheel', time=self.time_to_tick(bend.time),\n                channel=channel, pitch=bend.pitch))\n        # Add all control change events\n        for control_change in instrument.control_changes:\n            track.append(mido.Message(\n                'control_change',\n                time=self.time_to_tick(control_change.time),\n                channel=channel, control=control_change.number,\n                value=control_change.value))\n        # Sort all the events using the event_compare comparator.\n        track = sorted(track, key=functools.cmp_to_key(event_compare))\n\n        # If there's a note off event and a note on event with the same\n        # tick and pitch, put the note off event first\n        for n, (event1, event2) in enumerate(zip(track[:-1], track[1:])):\n            if (event1.time == event2.time and\n                    event1.type == 'note_on' and\n                    event2.type == 'note_on' and\n                    event1.note == event2.note and\n                    event1.velocity != 0 and\n                    event2.velocity == 0):\n                track[n] = event2\n                track[n + 1] = event1\n        # Finally, add in an end of track event\n        track.append(mido.MetaMessage(\n            'end_of_track', time=track[-1].time + 1))\n        # Add to the list of output tracks\n        mid.tracks.append(track)\n    # Turn ticks to relative time from absolute\n    for track in mid.tracks:\n        tick = 0\n        for event in track:\n            event.time -= tick\n            tick += event.time\n    # Write it out\n    if isinstance(filename, six.string_types) or isinstance(filename, pathlib.PurePath):\n        # If a string or path was given, pass it as the filename\n        mid.save(filename=filename)\n    else:\n        # Otherwise, try passing it in as a file pointer\n        mid.save(file=filename)\n",
      "asOf": "2026-11-17"
    },
    "F22": {
      "label": "Project function reference, mido",
      "display": "pretty_midi.py · write()",
      "asOf": "2026-11-17"
    },
    "F23": {
      "label": "Project repository, mido",
      "display": "craffel/pretty-midi",
      "asOf": "2026-11-17"
    },
    "F24": {
      "label": "Project stars, craffel/pretty-midi",
      "display": "1.1K",
      "asOf": "2026-11-17"
    },
    "F25": {
      "label": "Project push date, craffel/pretty-midi",
      "display": "Nov 2026",
      "asOf": "2026-11-08"
    },
    "F26": {
      "label": "Library name, music21",
      "display": "music21",
      "asOf": "2026-11-17"
    },
    "F27": {
      "label": "Monthly downloads, music21",
      "display": "901.1K",
      "asOf": "2026-11-16"
    },
    "F28": {
      "label": "License, music21",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-17"
    },
    "F29": {
      "label": "Package release, music21",
      "display": "10.5.2, Oct 2026",
      "asOf": "2026-10-28"
    },
    "F30": {
      "label": "Package release date, music21",
      "display": "Oct 2026",
      "asOf": "2026-10-28"
    },
    "F31": {
      "label": "Repository stars, music21",
      "display": "2.6K",
      "asOf": "2026-11-17"
    },
    "F32": {
      "label": "Reads MIDI files, music21",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F33": {
      "label": "Writes MIDI files, music21",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F34": {
      "label": "Output formats, music21",
      "display": "MIDI, MusicXML",
      "asOf": "2026-11-17"
    },
    "F35": {
      "label": "Install, music21",
      "display": "pip install music21",
      "asOf": "2026-11-17"
    },
    "F36": {
      "label": "What it does, music21",
      "display": "Provides tools for computer-aided musical analysis and score processing.",
      "asOf": "2026-11-17"
    },
    "F37": {
      "label": "strengths lead, music21",
      "display": "Structures notes into musical streams",
      "asOf": "2026-11-17"
    },
    "F38": {
      "label": "strengths, music21",
      "display": "Place notes and nested musical content inside Stream containers.",
      "asOf": "2026-11-17"
    },
    "F39": {
      "label": "strengths lead, music21",
      "display": "Imports and exports score notation",
      "asOf": "2026-11-17"
    },
    "F40": {
      "label": "strengths, music21",
      "display": "Read and write MusicXML alongside MIDI and other music formats.",
      "asOf": "2026-11-17"
    },
    "F41": {
      "label": "limitations lead, music21",
      "display": "Graphical notation needs external software",
      "asOf": "2026-11-17"
    },
    "F42": {
      "label": "limitations, music21",
      "display": "Configure a supported score viewer before calling graphical show.",
      "asOf": "2026-11-17"
    },
    "F43": {
      "label": "Quickstart, music21",
      "display": "from music21 import *\nnote1 = note.Note('C4')\nnote2 = note.Note('F#4')\n\n\nnote1.duration.type = 'half'\nnote1.duration.quarterLength\n\n\nnote3 = note.Note('B-2')\n\n\nstream1 = stream.Stream()\n\n\nstream1.append(note1)\nstream1.append(note2)\nstream1.append(note3)\n\n\nstream1.show('text')\n\n",
      "asOf": "2026-11-17"
    },
    "F44": {
      "label": "Quickstart source reference, music21",
      "display": "usersGuide_04_stream1.html",
      "asOf": "2026-11-17"
    },
    "F45": {
      "label": "Project function, music21",
      "display": "def _m21Parse(f, fmt=None, remove_perc=True):\n    \"\"\"\n\n    Parameters\n    ----------\n    f :\n\n    fmt :\n         (Default value = None)\n\n    Returns\n    -------\n\n    \"\"\"\n    import music21\n    s = music21.converter.parse(f, format=fmt, forceSource=True)\n    if remove_perc:\n\n        for el in s.recurse():\n            if set(el.classes).intersection(['PercussionChord', 'Unpitched']):  # or 'Piano'\n                # el.activeSite.replace(el, instrument.Violin())\n                el.activeSite.remove(el)\n\n        # perc = [\n        #     p\n        #     for p in s.parts\n        #     if list(p.recurse().getElementsByClass([\"PercussionClef\", \"PercussionChord\"]))\n        # ]\n        # s.remove(perc, recurse=True)\n    return s\n",
      "asOf": "2026-11-17"
    },
    "F46": {
      "label": "Project function reference, music21",
      "display": "parser.py · _m21Parse()",
      "asOf": "2026-11-17"
    },
    "F47": {
      "label": "Project repository, music21",
      "display": "MusicLang/musiclang",
      "asOf": "2026-11-17"
    },
    "F48": {
      "label": "Project stars, MusicLang/musiclang",
      "display": "207",
      "asOf": "2026-11-17"
    },
    "F49": {
      "label": "Project push date, MusicLang/musiclang",
      "display": "Mar 2024",
      "asOf": "2024-03-25"
    },
    "F50": {
      "label": "Library name, pretty-midi",
      "display": "pretty_midi",
      "asOf": "2026-11-17"
    },
    "F51": {
      "label": "Monthly downloads, pretty-midi",
      "display": "694.9K",
      "asOf": "2026-11-16"
    },
    "F52": {
      "label": "License, pretty-midi",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F53": {
      "label": "Package release, pretty-midi",
      "display": "0.2.11.post0, Jul 2026",
      "asOf": "2026-07-28"
    },
    "F54": {
      "label": "Package release date, pretty-midi",
      "display": "Jul 2026",
      "asOf": "2026-07-28"
    },
    "F55": {
      "label": "Repository stars, pretty-midi",
      "display": "1.1K",
      "asOf": "2026-11-17"
    },
    "F56": {
      "label": "Reads MIDI files, pretty-midi",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F57": {
      "label": "Writes MIDI files, pretty-midi",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F58": {
      "label": "Output formats, pretty-midi",
      "display": "MIDI",
      "asOf": "2026-11-17"
    },
    "F59": {
      "label": "Install, pretty-midi",
      "display": "pip install pretty-midi",
      "asOf": "2026-11-17"
    },
    "F60": {
      "label": "What it does, pretty-midi",
      "display": "Represents MIDI instruments and note events for analysis, editing, and synthesis.",
      "asOf": "2026-11-17"
    },
    "F61": {
      "label": "strengths lead, pretty-midi",
      "display": "Uses seconds for note timing",
      "asOf": "2026-11-17"
    },
    "F62": {
      "label": "strengths, pretty-midi",
      "display": "Read note start and end positions in absolute seconds.",
      "asOf": "2026-11-17"
    },
    "F63": {
      "label": "strengths lead, pretty-midi",
      "display": "Builds piano-roll note matrices",
      "asOf": "2026-11-17"
    },
    "F64": {
      "label": "strengths, pretty-midi",
      "display": "Convert instrument notes into a matrix of pitch activity over time.",
      "asOf": "2026-11-17"
    },
    "F65": {
      "label": "limitations lead, pretty-midi",
      "display": "Basic waveform synthesis omits drums",
      "asOf": "2026-11-17"
    },
    "F66": {
      "label": "limitations, pretty-midi",
      "display": "Use a drum-capable synthesizer to render percussion.",
      "asOf": "2026-11-17"
    },
    "F67": {
      "label": "Quickstart, pretty-midi",
      "display": "import pretty_midi\n# Create a PrettyMIDI object\ncello_c_chord = pretty_midi.PrettyMIDI()\n# Create an Instrument instance for a cello instrument\ncello_program = pretty_midi.instrument_name_to_program('Cello')\ncello = pretty_midi.Instrument(program=cello_program)\n# Iterate over note names, which will be converted to note number later\nfor note_name in ['C5', 'E5', 'G5']:\n    # Retrieve the MIDI note number for this note name\n    note_number = pretty_midi.note_name_to_number(note_name)\n    # Create a Note instance for this note, starting at 0s and ending at .5s\n    note = pretty_midi.Note(velocity=100, pitch=note_number, start=0, end=.5)\n    # Add it to our cello instrument\n    cello.notes.append(note)\n# Add the cello instrument to the PrettyMIDI object\ncello_c_chord.instruments.append(cello)\n# Write out the MIDI data\ncello_c_chord.write('cello-C-chord.mid')\n",
      "asOf": "2026-11-17"
    },
    "F68": {
      "label": "Project function, pretty-midi",
      "display": "def note_sequence_to_pretty_midi(\n    sequence, drop_events_n_seconds_after_last_note=None):\n  \"\"\"Convert NoteSequence to a PrettyMIDI.\n\n  Time is stored in the NoteSequence in absolute values (seconds) as opposed to\n  relative values (MIDI ticks). When the NoteSequence is translated back to\n  PrettyMIDI the absolute time is retained. The tempo map is also recreated.\n\n  Args:\n    sequence: A NoteSequence.\n    drop_events_n_seconds_after_last_note: Events (e.g., time signature changes)\n        that occur this many seconds after the last note will be dropped. If\n        None, then no events will be dropped.\n\n  Returns:\n    A pretty_midi.PrettyMIDI object or None if sequence could not be decoded.\n  \"\"\"\n  ticks_per_quarter = sequence.ticks_per_quarter or constants.STANDARD_PPQ\n\n  max_event_time = None\n  if drop_events_n_seconds_after_last_note is not None:\n    max_event_time = (max([n.end_time for n in sequence.notes] or [0]) +\n                      drop_events_n_seconds_after_last_note)\n\n  # Try to find a tempo at time zero. The list is not guaranteed to be in order.\n  initial_seq_tempo = None\n  for seq_tempo in sequence.tempos:\n    if seq_tempo.time == 0:\n      initial_seq_tempo = seq_tempo\n      break\n\n  kwargs = {}\n  if initial_seq_tempo:\n    kwargs['initial_tempo'] = initial_seq_tempo.qpm\n  else:\n    kwargs['initial_tempo'] = constants.DEFAULT_QUARTERS_PER_MINUTE\n\n  pm = pretty_midi.PrettyMIDI(resolution=ticks_per_quarter, **kwargs)\n\n  # Create an empty instrument to contain time and key signatures.\n  instrument = pretty_midi.Instrument(0)\n  pm.instruments.append(instrument)\n\n  # Populate time signatures.\n  for seq_ts in sequence.time_signatures:\n    if max_event_time and seq_ts.time > max_event_time:\n      continue\n    time_signature = pretty_midi.containers.TimeSignature(\n        seq_ts.numerator, seq_ts.denominator, seq_ts.time)\n    pm.time_signature_changes.append(time_signature)\n\n  # Populate key signatures.\n  for seq_key in sequence.key_signatures:\n    if max_event_time and seq_key.time > max_event_time:\n      continue\n    key_number = seq_key.key\n    if seq_key.mode == seq_key.MINOR:\n      key_number += _PRETTY_MIDI_MAJOR_TO_MINOR_OFFSET\n    key_signature = pretty_midi.containers.KeySignature(\n        key_number, seq_key.time)\n    pm.key_signature_changes.append(key_signature)\n\n  # Populate tempos.\n  # TODO(douglaseck): Update this code if pretty_midi adds the ability to\n  # write tempo.\n  for seq_tempo in sequence.tempos:\n    # Skip if this tempo was added in the PrettyMIDI constructor.\n    if seq_tempo == initial_seq_tempo:\n      continue\n    if max_event_time and seq_tempo.time > max_event_time:\n      continue\n    tick_scale = 60.0 / (pm.resolution * seq_tempo.qpm)\n    tick = pm.time_to_tick(seq_tempo.time)\n    # pylint: disable=protected-access\n    pm._tick_scales.append((tick, tick_scale))\n    pm._update_tick_to_time(0)\n    # pylint: enable=protected-access\n\n  # Populate instrument names by first creating an instrument map between\n  # instrument index and name.\n  # Then, going over this map in the instrument event for loop\n  inst_infos = {}\n  for inst_info in sequence.instrument_infos:\n    inst_infos[inst_info.instrument] = inst_info.name\n\n  # Populate instrument events by first gathering notes and other event types\n  # in lists then write them sorted to the PrettyMidi object.\n  instrument_events = collections.defaultdict(\n      lambda: collections.defaultdict(list))\n  for seq_note in sequence.notes:\n    instrument_events[(seq_note.instrument, seq_note.program,\n                       seq_note.is_drum)]['notes'].append(\n                           pretty_midi.Note(\n                               seq_note.velocity, seq_note.pitch,\n                               seq_note.start_time, seq_note.end_time))\n  for seq_bend in sequence.pitch_bends:\n    if max_event_time and seq_bend.time > max_event_time:\n      continue\n    instrument_events[(seq_bend.instrument, seq_bend.program,\n                       seq_bend.is_drum)]['bends'].append(\n                           pretty_midi.PitchBend(seq_bend.bend, seq_bend.time))\n  for seq_cc in sequence.control_changes:\n    if max_event_time and seq_cc.time > max_event_time:\n      continue\n    instrument_events[(seq_cc.instrument, seq_cc.program,\n                       seq_cc.is_drum)]['controls'].append(\n                           pretty_midi.ControlChange(\n                               seq_cc.control_number,\n                               seq_cc.control_value, seq_cc.time))\n\n  for (instr_id, prog_id, is_drum) in sorted(instrument_events.keys()):\n    # For instr_id 0 append to the instrument created above.\n    if instr_id > 0:\n      if is_drum:\n        name = 'Drums'\n      else:\n        name = pretty_midi.program_to_instrument_name(prog_id)\n      instrument = pretty_midi.Instrument(prog_id, is_drum, name)\n      pm.instruments.append(instrument)\n    else:\n      instrument.is_drum = is_drum\n    # propagate instrument name to the midi file\n    instrument.program = prog_id\n    if instr_id in inst_infos:\n      instrument.name = inst_infos[instr_id]\n    instrument.notes = instrument_events[\n        (instr_id, prog_id, is_drum)]['notes']\n    instrument.pitch_bends = instrument_events[\n        (instr_id, prog_id, is_drum)]['bends']\n    instrument.control_changes = instrument_events[\n        (instr_id, prog_id, is_drum)]['controls']\n\n  return pm\n",
      "asOf": "2026-11-17"
    },
    "F69": {
      "label": "Project function reference, pretty-midi",
      "display": "midi_io.py · note_sequence_to_pretty_midi()",
      "asOf": "2026-11-17"
    },
    "F70": {
      "label": "Project repository, pretty-midi",
      "display": "magenta/note-seq",
      "asOf": "2026-11-17"
    },
    "F71": {
      "label": "Project stars, magenta/note-seq",
      "display": "237",
      "asOf": "2026-11-17"
    },
    "F72": {
      "label": "Project push date, magenta/note-seq",
      "display": "Feb 2025",
      "asOf": "2025-02-28"
    },
    "F73": {
      "label": "Library name, miditoolkit",
      "display": "Miditoolkit",
      "asOf": "2026-11-17"
    },
    "F74": {
      "label": "Monthly downloads, miditoolkit",
      "display": "23.0K",
      "asOf": "2026-11-16"
    },
    "F75": {
      "label": "License, miditoolkit",
      "display": "MIT",
      "asOf": "2026-11-17"
    },
    "F76": {
      "label": "Package release, miditoolkit",
      "display": "1.0.1, Nov 2023",
      "asOf": "2023-11-23"
    },
    "F77": {
      "label": "Package release date, miditoolkit",
      "display": "Nov 2023",
      "asOf": "2023-11-23"
    },
    "F78": {
      "label": "Repository stars, miditoolkit",
      "display": "285",
      "asOf": "2026-11-17"
    },
    "F79": {
      "label": "Reads MIDI files, miditoolkit",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F80": {
      "label": "Writes MIDI files, miditoolkit",
      "display": "Built-in",
      "asOf": "2026-11-17"
    },
    "F81": {
      "label": "Output formats, miditoolkit",
      "display": "MIDI",
      "asOf": "2026-11-17"
    },
    "F82": {
      "label": "Install, miditoolkit",
      "display": "pip install miditoolkit",
      "asOf": "2026-11-17"
    },
    "F83": {
      "label": "What it does, miditoolkit",
      "display": "Loads, edits and writes MIDI through note objects and tick-based event positions.",
      "asOf": "2026-11-17"
    },
    "F84": {
      "label": "strengths lead, miditoolkit",
      "display": "Edits notes at absolute ticks",
      "asOf": "2026-11-17"
    },
    "F85": {
      "label": "strengths, miditoolkit",
      "display": "Set note start and end positions directly in MIDI tick units.",
      "asOf": "2026-11-17"
    },
    "F86": {
      "label": "strengths lead, miditoolkit",
      "display": "Handles tempo and marker events",
      "asOf": "2026-11-17"
    },
    "F87": {
      "label": "strengths, miditoolkit",
      "display": "Edit tempo, time signatures, and text markers alongside notes.",
      "asOf": "2026-11-17"
    },
    "F88": {
      "label": "limitations lead, miditoolkit",
      "display": "Audio alignment needs time conversion",
      "asOf": "2026-11-17"
    },
    "F89": {
      "label": "limitations, miditoolkit",
      "display": "Use get_tick_to_time_mapping before comparing tick positions with audio timestamps.",
      "asOf": "2026-11-17"
    },
    "F90": {
      "label": "Quickstart, miditoolkit",
      "display": "from miditoolkit import MidiFile\nfrom miditoolkit.midi.utils import example_midi_file\n\npath_midi = example_midi_file()\nmidi_obj = MidiFile(path_midi)\n\nprint(midi_obj)\n",
      "asOf": "2026-11-17"
    },
    "F91": {
      "label": "Project function, miditoolkit",
      "display": "def write_midi(words, word2event, output_path, prompt_path=None):\n    events = word_to_event(words, word2event)\n    # get downbeat and note (no time)\n    temp_notes = []\n    temp_chords = []\n    temp_tempos = []\n    for i in range(len(events)-3):\n        if events[i].name == 'Bar' and i > 0:\n            temp_notes.append('Bar')\n            temp_chords.append('Bar')\n            temp_tempos.append('Bar')\n        elif events[i].name == 'Position' and \\\n            events[i+1].name == 'Note Velocity' and \\\n            events[i+2].name == 'Note On' and \\\n            events[i+3].name == 'Note Duration':\n            # start time and end time from position\n            position = int(events[i].value.split('/')[0]) - 1\n            # velocity\n            index = int(events[i+1].value)\n            velocity = int(DEFAULT_VELOCITY_BINS[index])\n            # pitch\n            pitch = int(events[i+2].value)\n            # duration\n            index = int(events[i+3].value)\n            duration = DEFAULT_DURATION_BINS[index]\n            # adding\n            temp_notes.append([position, velocity, pitch, duration])\n        elif events[i].name == 'Position' and events[i+1].name == 'Chord':\n            position = int(events[i].value.split('/')[0]) - 1\n            temp_chords.append([position, events[i+1].value])\n        elif events[i].name == 'Position' and \\\n            events[i+1].name == 'Tempo Class' and \\\n            events[i+2].name == 'Tempo Value':\n            position = int(events[i].value.split('/')[0]) - 1\n            if events[i+1].value == 'slow':\n                tempo = DEFAULT_TEMPO_INTERVALS[0].start + int(events[i+2].value)\n            elif events[i+1].value == 'mid':\n                tempo = DEFAULT_TEMPO_INTERVALS[1].start + int(events[i+2].value)\n            elif events[i+1].value == 'fast':\n                tempo = DEFAULT_TEMPO_INTERVALS[2].start + int(events[i+2].value)\n            temp_tempos.append([position, tempo])\n    # get specific time for notes\n    ticks_per_beat = DEFAULT_RESOLUTION\n    ticks_per_bar = DEFAULT_RESOLUTION * 4 # assume 4/4\n    notes = []\n    current_bar = 0\n    for note in temp_notes:\n        if note == 'Bar':\n            current_bar += 1\n        else:\n            position, velocity, pitch, duration = note\n            # position (start time)\n            current_bar_st = current_bar * ticks_per_bar\n            current_bar_et = (current_bar + 1) * ticks_per_bar\n            flags = np.linspace(current_bar_st, current_bar_et, DEFAULT_FRACTION, endpoint=False, dtype=int)\n            st = flags[position]\n            # duration (end time)\n            et = st + duration\n            notes.append(miditoolkit.Note(velocity, pitch, st, et))\n    # get specific time for chords\n    if len(temp_chords) > 0:\n        chords = []\n        current_bar = 0\n        for chord in temp_chords:\n            if chord == 'Bar':\n                current_bar += 1\n            else:\n                position, value = chord\n                # position (start time)\n                current_bar_st = current_bar * ticks_per_bar\n                current_bar_et = (current_bar + 1) * ticks_per_bar\n                flags = np.linspace(current_bar_st, current_bar_et, DEFAULT_FRACTION, endpoint=False, dtype=int)\n                st = flags[position]\n                chords.append([st, value])\n    # get specific time for tempos\n    tempos = []\n    current_bar = 0\n    for tempo in temp_tempos:\n        if tempo == 'Bar':\n            current_bar += 1\n        else:\n            position, value = tempo\n            # position (start time)\n            current_bar_st = current_bar * ticks_per_bar\n            current_bar_et = (current_bar + 1) * ticks_per_bar\n            flags = np.linspace(current_bar_st, current_bar_et, DEFAULT_FRACTION, endpoint=False, dtype=int)\n            st = flags[position]\n            tempos.append([int(st), value])\n    # write\n    if prompt_path:\n        midi = miditoolkit.midi.parser.MidiFile(prompt_path)\n        #\n        last_time = DEFAULT_RESOLUTION * 4 * 4\n        # note shift\n        for note in notes:\n            note.start += last_time\n            note.end += last_time\n        midi.instruments[0].notes.extend(notes)\n        # tempo changes\n        temp_tempos = []\n        for tempo in midi.tempo_changes:\n            if tempo.time < DEFAULT_RESOLUTION*4*4:\n                temp_tempos.append(tempo)\n            else:\n                break\n        for st, bpm in tempos:\n            st += last_time\n            temp_tempos.append(miditoolkit.midi.containers.TempoChange(bpm, st))\n        midi.tempo_changes = temp_tempos\n        # write chord into marker\n        if len(temp_chords) > 0:\n            for c in chords:\n                midi.markers.append(\n                    miditoolkit.midi.containers.Marker(text=c[1], time=c[0]+last_time))\n    else:\n        midi = miditoolkit.midi.parser.MidiFile()\n        midi.ticks_per_beat = DEFAULT_RESOLUTION\n        # write instrument\n        inst = miditoolkit.midi.containers.Instrument(0, is_drum=False)\n        inst.notes = notes\n        midi.instruments.append(inst)\n        # write tempo\n        tempo_changes = []\n        for st, bpm in tempos:\n            tempo_changes.append(miditoolkit.midi.containers.TempoChange(bpm, st))\n        midi.tempo_changes = tempo_changes\n        # write chord into marker\n        if len(temp_chords) > 0:\n            for c in chords:\n                midi.markers.append(\n                    miditoolkit.midi.containers.Marker(text=c[1], time=c[0]))\n    # write\n    midi.dump(output_path)\n",
      "asOf": "2026-11-17"
    },
    "F92": {
      "label": "Project function reference, miditoolkit",
      "display": "utils.py · write_midi()",
      "asOf": "2026-11-17"
    },
    "F93": {
      "label": "Project repository, miditoolkit",
      "display": "YatingMusic/remi",
      "asOf": "2026-11-17"
    },
    "F94": {
      "label": "Project stars, YatingMusic/remi",
      "display": "606",
      "asOf": "2026-11-17"
    },
    "F95": {
      "label": "Project push date, YatingMusic/remi",
      "display": "Nov 2022",
      "asOf": "2022-11-15"
    },
    "F96": {
      "label": "Developer need",
      "display": "MIDI messages and port workflows",
      "asOf": "2026-11-17"
    },
    "F97": {
      "label": "Why choose mido",
      "display": "individual messages and file tracks",
      "asOf": "2026-11-17"
    },
    "F98": {
      "label": "Developer need in introduction",
      "display": "MIDI messages and port workflows",
      "asOf": "2026-11-17"
    },
    "F99": {
      "label": "Developer need",
      "display": "Notes aligned with audio time",
      "asOf": "2026-11-17"
    },
    "F100": {
      "label": "Why choose pretty-midi",
      "display": "absolute seconds for note start and end",
      "asOf": "2026-11-17"
    },
    "F101": {
      "label": "Developer need in introduction",
      "display": "notes aligned with audio time",
      "asOf": "2026-11-17"
    },
    "F102": {
      "label": "Developer need",
      "display": "Symbolic editing in MIDI ticks",
      "asOf": "2026-11-17"
    },
    "F103": {
      "label": "Why choose miditoolkit",
      "display": "absolute tick positions on note events",
      "asOf": "2026-11-17"
    },
    "F104": {
      "label": "Developer need in introduction",
      "display": "symbolic editing in MIDI ticks",
      "asOf": "2026-11-17"
    },
    "F105": {
      "label": "Developer need",
      "display": "Score notation workflows",
      "asOf": "2026-11-17"
    },
    "F106": {
      "label": "Why choose music21",
      "display": "MusicXML and other musical data formats",
      "asOf": "2026-11-17"
    },
    "F107": {
      "label": "Developer need in introduction",
      "display": "score notation workflows",
      "asOf": "2026-11-17"
    },
    "F108": {
      "label": "When to consider mido",
      "display": "message-level MIDI processing is sufficient",
      "asOf": "2026-11-17"
    },
    "F109": {
      "label": "Page introduction",
      "display": "Python music libraries let music-software developers analyze and manipulate musical data.",
      "asOf": "2026-11-17"
    },
    "F110": {
      "label": "FAQ: Which Python music library should I choose?",
      "display": "Mido handles MIDI ports, messages, and files.",
      "asOf": "2026-11-17"
    },
    "F111": {
      "label": "FAQ: Which Python music library should I choose?",
      "display": "pretty_midi represents note start and end times in absolute seconds.",
      "asOf": "2026-11-17"
    },
    "F112": {
      "label": "FAQ: Which Python music library should I choose?",
      "display": "Miditoolkit represents note positions in absolute ticks.",
      "asOf": "2026-11-17"
    },
    "F113": {
      "label": "FAQ: Which Python music library should I choose?",
      "display": "music21 imports and exports notation formats including MusicXML.",
      "asOf": "2026-11-17"
    },
    "F114": {
      "label": "FAQ: Does Mido need a backend to read a MIDI file?",
      "display": "MidiFile handles file reading, writing, and playback.",
      "asOf": "2026-11-17"
    },
    "F115": {
      "label": "FAQ: Does Mido need a backend to read a MIDI file?",
      "display": "Live ports use a backend such as the python-rtmidi wrapper.",
      "asOf": "2026-11-17"
    },
    "F116": {
      "label": "FAQ: Are Mido message times in ticks or seconds?",
      "display": "Messages within a track store delta ticks.",
      "asOf": "2026-11-17"
    },
    "F117": {
      "label": "FAQ: Are Mido message times in ticks or seconds?",
      "display": "Iteration over MidiFile yields messages with delta seconds.",
      "asOf": "2026-11-17"
    },
    "F118": {
      "label": "FAQ: Can every Mido file report a playback length?",
      "display": "Asynchronous files with independent tracks cannot provide a single playback length; accessing length raises ValueError.",
      "asOf": "2026-11-17"
    },
    "F119": {
      "label": "FAQ: What timing units does pretty_midi use for notes?",
      "display": "Note start and end times are absolute seconds.",
      "asOf": "2026-11-17"
    },
    "F120": {
      "label": "FAQ: What does a pretty_midi piano roll contain?",
      "display": "Instrument.get_piano_roll computes a matrix representing the instrument’s notes over time.",
      "asOf": "2026-11-17"
    },
    "F121": {
      "label": "FAQ: Why can basic pretty_midi synthesis produce silent drums?",
      "display": "The basic Instrument.synthesize waveform method returns zeros for drum instruments.",
      "asOf": "2026-11-17"
    },
    "F122": {
      "label": "FAQ: What does pretty_midi SoundFont synthesis require?",
      "display": "FluidSynth synthesis needs the fluidsynth program and pyfluidsynth.",
      "asOf": "2026-11-17"
    },
    "F123": {
      "label": "FAQ: How does Miditoolkit convert ticks into audio time?",
      "display": "get_tick_to_time_mapping builds a mapping using beat resolution, the maximum tick, and tempo changes.",
      "asOf": "2026-11-17"
    },
    "F124": {
      "label": "FAQ: Does music21 require a viewer for text output?",
      "display": "Stream.show with the text format displays the stream as text.",
      "asOf": "2026-11-17"
    },
    "F125": {
      "label": "FAQ: Does music21 require a viewer for text output?",
      "display": "Graphical notation uses a separately installed score application.",
      "asOf": "2026-11-17"
    },
    "F126": {
      "label": "FAQ: Can music21 export notation as MusicXML?",
      "display": "MusicXML and MIDI are supported import and export formats.",
      "asOf": "2026-11-17"
    },
    "F127": {
      "label": "FAQ: Are all data bundled with music21 covered by its code license?",
      "display": "The code license and the copyright/license of encoded corpus scores have different scopes.",
      "asOf": "2026-11-17"
    },
    "F128": {
      "label": "Library name, mido",
      "display": "Mido",
      "asOf": "2026-11-20"
    },
    "F129": {
      "label": "Monthly downloads, mido",
      "display": "1.4M",
      "asOf": "2026-11-20"
    },
    "F130": {
      "label": "License, mido",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F131": {
      "label": "Package release, mido",
      "display": "1.3.3",
      "asOf": "2026-11-20"
    },
    "F132": {
      "label": "Package release date, mido",
      "display": "Oct 2024",
      "asOf": "2026-11-20"
    },
    "F133": {
      "label": "Install, mido",
      "display": "python -m pip install mido",
      "asOf": "2026-11-20"
    },
    "F134": {
      "label": "Quickstart, mido",
      "display": "import mido\nmessage = mido.Message('note_on', note=60, velocity=64)\nprint(message)\n",
      "asOf": "2026-11-20"
    },
    "F135": {
      "label": "Repository stars, mido",
      "display": "1.7K",
      "asOf": "2026-11-20"
    },
    "F136": {
      "label": "Read MIDI event model, mido",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F137": {
      "label": "Write MIDI files, mido",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F138": {
      "label": "Live MIDI ports, mido",
      "display": "Via plugin",
      "asOf": "2026-11-20"
    },
    "F139": {
      "label": "Time representation, mido",
      "display": "MIDI-track delta ticks; file iteration converts timing",
      "asOf": "2026-11-20"
    },
    "F140": {
      "label": "File-only setup, mido",
      "display": "Hardware backend optional for file/message work",
      "asOf": "2026-11-20"
    },
    "F141": {
      "label": "Declared Python requirement, mido",
      "display": "~=3.7",
      "asOf": "2026-11-20"
    },
    "F142": {
      "label": "Project function, mido",
      "display": "def write(self, filename, round_tempo=False):\n    \"\"\"Write the MIDI data out to a .mid file.\n\n    Parameters\n    ----------\n    filename : str or file\n        Path or file to write .mid file to.\n    round_tempo : bool\n        If True, round MIDI tempos to the nearest integer microsecond per\n        quarter note. If False, truncate them for backwards compatibility.\n        Default is False.\n\n    \"\"\"\n\n    def event_compare(event1, event2):\n        \"\"\"Compares two events for sorting.\n\n        Events are sorted by tick time ascending. Events with the same tick\n        time ares sorted by event type. Some events are sorted by\n        additional values. For example, Note On events are sorted by pitch\n        then velocity, ensuring that a Note Off (Note On with velocity 0)\n        will never follow a Note On with the same pitch.\n\n        Parameters\n        ----------\n        event1, event2 : mido.Message\n           Two events to be compared.\n        \"\"\"\n        # Construct a dictionary which will map event names to numeric\n        # values which produce the correct sorting.  Each dictionary value\n        # is a function which accepts an event and returns a score.\n        # The spacing for these scores is 256, which is larger than the\n        # largest value a MIDI value can take.\n        secondary_sort = {\n            'set_tempo': lambda e: (1 * 256 * 256),\n            'time_signature': lambda e: (2 * 256 * 256),\n            'key_signature': lambda e: (3 * 256 * 256),\n            'lyrics': lambda e: (4 * 256 * 256),\n            'text_events' :lambda e: (5 * 256 * 256),\n            'program_change': lambda e: (6 * 256 * 256),\n            'pitchwheel': lambda e: ((7 * 256 * 256) + e.pitch),\n            'control_change': lambda e: (\n                (8 * 256 * 256) + (e.control * 256) + e.value),\n            'note_off': lambda e: ((9 * 256 * 256) + (e.note * 256)),\n            'note_on': lambda e: (\n                (10 * 256 * 256) + (e.note * 256) + e.velocity),\n            'end_of_track': lambda e: (11 * 256 * 256)\n        }\n        # If the events have the same tick, and both events have types\n        # which appear in the secondary_sort dictionary, use the dictionary\n        # to determine their ordering.\n        if (event1.time == event2.time and\n                event1.type in secondary_sort and\n                event2.type in secondary_sort):\n            return (secondary_sort[event1.type](event1) -\n                    secondary_sort[event2.type](event2))\n        # Otherwise, just return the difference of their ticks.\n        return event1.time - event2.time\n\n    # Initialize output MIDI object\n    mid = mido.MidiFile(ticks_per_beat=self.resolution, charset=self._charset)\n    # Create track 0 with timing information\n    timing_track = mido.MidiTrack()\n    # Add a default time signature only if there is not one at time 0.\n    add_ts = True\n    if self.time_signature_changes:\n        add_ts = min([ts.time for ts in self.time_signature_changes]) > 0.0\n    if add_ts:\n        # Add time signature event with default values (4/4)\n        timing_track.append(mido.MetaMessage(\n            'time_signature', time=0, numerator=4, denominator=4))\n\n    # Add in each tempo change event\n    for (tick, tick_scale) in self._tick_scales:\n        # Convert seconds per tick to microseconds per quarter note\n        tempo = (mido.bpm2tempo(60./(tick_scale*self.resolution))\n                 if round_tempo else int(6e7/(60./(tick_scale*self.resolution))))\n        timing_track.append(mido.MetaMessage(\n            'set_tempo', time=tick, tempo=tempo))\n    # Add in each time signature\n    for ts in self.time_signature_changes:\n        timing_track.append(mido.MetaMessage(\n            'time_signature', time=self.time_to_tick(ts.time),\n            numerator=ts.numerator, denominator=ts.denominator))\n    # Add in each key signature\n    # Mido accepts key changes in a different format than pretty_midi, this\n    # list maps key number to mido key name\n    key_number_to_mido_key_name = [\n        'C', 'Db', 'D', 'Eb', 'E', 'F', 'F#', 'G', 'Ab', 'A', 'Bb', 'B',\n        'Cm', 'C#m', 'Dm', 'D#m', 'Em', 'Fm', 'F#m', 'Gm', 'G#m', 'Am',\n        'Bbm', 'Bm']\n    for ks in self.key_signature_changes:\n        timing_track.append(mido.MetaMessage(\n            'key_signature', time=self.time_to_tick(ks.time),\n            key=key_number_to_mido_key_name[ks.key_number]))\n    # Add in all lyrics events\n    for l in self.lyrics:\n        timing_track.append(mido.MetaMessage(\n            'lyrics', time=self.time_to_tick(l.time), text=l.text))\n    # Add text events\n    for l in self.text_events:\n        timing_track.append(mido.MetaMessage(\n            'text', time=self.time_to_tick(l.time), text=l.text))\n    # Sort the (absolute-tick-timed) events.\n    timing_track.sort(key=functools.cmp_to_key(event_compare))\n    # Add in an end of track event\n    timing_track.append(mido.MetaMessage(\n        'end_of_track', time=timing_track[-1].time + 1))\n    mid.tracks.append(timing_track)\n    # Create a list of possible channels to assign - this seems to matter\n    # for some synths.\n    channels = list(range(16))\n    # Don't assign the drum channel by mistake!\n    channels.remove(9)\n    for n, instrument in enumerate(self.instruments):\n        # Initialize track for this instrument\n        track = mido.MidiTrack()\n        # Add track name event if instrument has a name\n        if instrument.name:\n            track.append(mido.MetaMessage(\n                'track_name', time=0, name=instrument.name))\n        # If it's a drum event, we need to set channel to 9\n        if instrument.is_drum:\n            channel = 9\n        # Otherwise, choose a channel from the possible channel list\n        else:\n            channel = channels[n % len(channels)]\n        # Set the program number\n        track.append(mido.Message(\n            'program_change', time=0, program=instrument.program,\n            channel=channel))\n        # Add all note events\n        for note in instrument.notes:\n            # Construct the note-on event\n            track.append(mido.Message(\n                'note_on', time=self.time_to_tick(note.start),\n                channel=channel, note=note.pitch, velocity=note.velocity))\n            # Also need a note-off event (note on with velocity 0)\n            track.append(mido.Message(\n                'note_on', time=self.time_to_tick(note.end),\n                channel=channel, note=note.pitch, velocity=0))\n        # Add all pitch bend events\n        for bend in instrument.pitch_bends:\n            track.append(mido.Message(\n                'pitchwheel', time=self.time_to_tick(bend.time),\n                channel=channel, pitch=bend.pitch))\n        # Add all control change events\n        for control_change in instrument.control_changes:\n            track.append(mido.Message(\n                'control_change',\n                time=self.time_to_tick(control_change.time),\n                channel=channel, control=control_change.number,\n                value=control_change.value))\n        # Sort all the events using the event_compare comparator.\n        track = sorted(track, key=functools.cmp_to_key(event_compare))\n\n        # If there's a note off event and a note on event with the same\n        # tick and pitch, put the note off event first\n        for n, (event1, event2) in enumerate(zip(track[:-1], track[1:])):\n            if (event1.time == event2.time and\n                    event1.type == 'note_on' and\n                    event2.type == 'note_on' and\n                    event1.note == event2.note and\n                    event1.velocity != 0 and\n                    event2.velocity == 0):\n                track[n] = event2\n                track[n + 1] = event1\n        # Finally, add in an end of track event\n        track.append(mido.MetaMessage(\n            'end_of_track', time=track[-1].time + 1))\n        # Add to the list of output tracks\n        mid.tracks.append(track)\n    # Turn ticks to relative time from absolute\n    for track in mid.tracks:\n        tick = 0\n        for event in track:\n            event.time -= tick\n            tick += event.time\n    # Write it out\n    if isinstance(filename, six.string_types) or isinstance(filename, pathlib.PurePath):\n        # If a string or path was given, pass it as the filename\n        mid.save(filename=filename)\n    else:\n        # Otherwise, try passing it in as a file pointer\n        mid.save(file=filename)",
      "asOf": "2026-11-20"
    },
    "F143": {
      "label": "Project source file, mido",
      "display": "pretty_midi/pretty_midi.py",
      "asOf": "2026-11-20"
    },
    "F144": {
      "label": "Project full_name, mido",
      "display": "craffel/pretty-midi",
      "asOf": "2026-11-20"
    },
    "F145": {
      "label": "Project stargazers_count, mido",
      "display": "1.0K",
      "asOf": "2026-11-20"
    },
    "F146": {
      "label": "Library name, pedalboard",
      "display": "Pedalboard",
      "asOf": "2026-11-20"
    },
    "F147": {
      "label": "Monthly downloads, pedalboard",
      "display": "1.1M",
      "asOf": "2026-11-20"
    },
    "F148": {
      "label": "License, pedalboard",
      "display": "GPL-3.0",
      "asOf": "2026-11-20"
    },
    "F149": {
      "label": "Package release, pedalboard",
      "display": "0.9.26",
      "asOf": "2026-11-20"
    },
    "F150": {
      "label": "Package release date, pedalboard",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F151": {
      "label": "Install, pedalboard",
      "display": "python -m pip install pedalboard mido",
      "asOf": "2026-11-20"
    },
    "F152": {
      "label": "Quickstart, pedalboard",
      "display": "from pedalboard import load_plugin\nfrom mido import Message\ninstrument = load_plugin('your-instrument.vst3')\naudio = instrument(\n    [Message('note_on', note=60), Message('note_off', note=60, time=5)],\n    duration=5, sample_rate=44100,\n)\nprint(audio.shape)\n",
      "asOf": "2026-11-20"
    },
    "F153": {
      "label": "Official description, pedalboard",
      "display": "Adds effects to audio.",
      "asOf": "2026-11-20"
    },
    "F154": {
      "label": "Quickstart source file, pedalboard",
      "display": "docs/examples.rst",
      "asOf": "2026-11-20"
    },
    "F155": {
      "label": "Repository stars, pedalboard",
      "display": "6.5K",
      "asOf": "2026-11-20"
    },
    "F156": {
      "label": "Read MIDI event model, pedalboard",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F157": {
      "label": "Write MIDI files, pedalboard",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F158": {
      "label": "Live MIDI ports, pedalboard",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F159": {
      "label": "MIDI render input, pedalboard",
      "display": "Message lists with buffer-relative absolute seconds",
      "asOf": "2026-11-20"
    },
    "F160": {
      "label": "Required instrument, pedalboard",
      "display": "Installed VST3 or Audio Unit instrument plugin",
      "asOf": "2026-11-20"
    },
    "F161": {
      "label": "Audio output, pedalboard",
      "display": "Instrument processing returns rendered audio, not MIDI files",
      "asOf": "2026-11-20"
    },
    "F162": {
      "label": "Declared Python requirement, pedalboard",
      "display": ">=3.10",
      "asOf": "2026-11-20"
    },
    "F163": {
      "label": "Library name, music21",
      "display": "music21",
      "asOf": "2026-11-20"
    },
    "F164": {
      "label": "Monthly downloads, music21",
      "display": "972.5K",
      "asOf": "2026-11-20"
    },
    "F165": {
      "label": "License, music21",
      "display": "BSD-3-Clause",
      "asOf": "2026-11-20"
    },
    "F166": {
      "label": "Package release, music21",
      "display": "10.5.2",
      "asOf": "2026-11-20"
    },
    "F167": {
      "label": "Package release date, music21",
      "display": "Oct 2026",
      "asOf": "2026-11-20"
    },
    "F168": {
      "label": "Install, music21",
      "display": "python -m pip install music21",
      "asOf": "2026-11-20"
    },
    "F169": {
      "label": "Quickstart, music21",
      "display": "from music21 import note\nn = note.Note('C4')\nprint(n)\n",
      "asOf": "2026-11-20"
    },
    "F170": {
      "label": "Repository stars, music21",
      "display": "2.6K",
      "asOf": "2026-11-20"
    },
    "F171": {
      "label": "Read MIDI event model, music21",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F172": {
      "label": "Write MIDI files, music21",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F173": {
      "label": "Live MIDI ports, music21",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F174": {
      "label": "Musical model, music21",
      "display": "Score/Part/Stream, notation, and quarter-length durations",
      "asOf": "2026-11-20"
    },
    "F175": {
      "label": "Input format handling, music21",
      "display": "MusicXML, MIDI, and other symbolic formats",
      "asOf": "2026-11-20"
    },
    "F176": {
      "label": "Declared Python requirement, music21",
      "display": ">=3.11",
      "asOf": "2026-11-20"
    },
    "F177": {
      "label": "Project function, music21",
      "display": "def _m21Parse(f, fmt=None, remove_perc=True):\n    \"\"\"\n\n    Parameters\n    ----------\n    f :\n\n    fmt :\n         (Default value = None)\n\n    Returns\n    -------\n\n    \"\"\"\n    import music21\n    s = music21.converter.parse(f, format=fmt, forceSource=True)\n    if remove_perc:\n\n        for el in s.recurse():\n            if set(el.classes).intersection(['PercussionChord', 'Unpitched']):  # or 'Piano'\n                # el.activeSite.replace(el, instrument.Violin())\n                el.activeSite.remove(el)\n\n        # perc = [\n        #     p\n        #     for p in s.parts\n        #     if list(p.recurse().getElementsByClass([\"PercussionClef\", \"PercussionChord\"]))\n        # ]\n        # s.remove(perc, recurse=True)\n    return s",
      "asOf": "2026-11-20"
    },
    "F178": {
      "label": "Project source file, music21",
      "display": "musiclang/analyze/parser.py",
      "asOf": "2026-11-20"
    },
    "F179": {
      "label": "Project full_name, music21",
      "display": "MusicLang/musiclang",
      "asOf": "2026-11-20"
    },
    "F180": {
      "label": "Project stargazers_count, music21",
      "display": "207",
      "asOf": "2026-11-20"
    },
    "F181": {
      "label": "Library name, pretty-midi",
      "display": "pretty_midi",
      "asOf": "2026-11-20"
    },
    "F182": {
      "label": "Monthly downloads, pretty-midi",
      "display": "690.8K",
      "asOf": "2026-11-20"
    },
    "F183": {
      "label": "License, pretty-midi",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F184": {
      "label": "Package release, pretty-midi",
      "display": "0.2.11.post0",
      "asOf": "2026-11-20"
    },
    "F185": {
      "label": "Package release date, pretty-midi",
      "display": "Jul 2026",
      "asOf": "2026-11-20"
    },
    "F186": {
      "label": "Install, pretty-midi",
      "display": "python -m pip install pretty-midi",
      "asOf": "2026-11-20"
    },
    "F187": {
      "label": "Quickstart, pretty-midi",
      "display": "import pretty_midi\nmidi = pretty_midi.PrettyMIDI('example.mid')\nprint(midi.get_end_time())\n",
      "asOf": "2026-11-20"
    },
    "F188": {
      "label": "Repository stars, pretty-midi",
      "display": "1.0K",
      "asOf": "2026-11-20"
    },
    "F189": {
      "label": "Read MIDI event model, pretty-midi",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F190": {
      "label": "Write MIDI files, pretty-midi",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F191": {
      "label": "Live MIDI ports, pretty-midi",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F192": {
      "label": "Musical model, pretty-midi",
      "display": "Instrument/note/control events with second-based times",
      "asOf": "2026-11-20"
    },
    "F193": {
      "label": "Tempo changes, pretty-midi",
      "display": "Change times and quarter-notes-per-minute arrays",
      "asOf": "2026-11-20"
    },
    "F194": {
      "label": "Basic synthesis, pretty-midi",
      "display": "Drum instruments return zeros in basic synthesizer",
      "asOf": "2026-11-20"
    },
    "F195": {
      "label": "Underlying parser, pretty-midi",
      "display": "Depends on Mido",
      "asOf": "2026-11-20"
    },
    "F196": {
      "label": "Project function, pretty-midi",
      "display": "def midi_to_note_sequence(midi_data):\n  \"\"\"Convert MIDI file contents to a NoteSequence.\n\n  Converts a MIDI file encoded as a string into a NoteSequence. Decoding errors\n  are very common when working with large sets of MIDI files, so be sure to\n  handle MIDIConversionError exceptions.\n\n  Args:\n    midi_data: A string containing the contents of a MIDI file or populated\n        pretty_midi.PrettyMIDI object.\n\n  Returns:\n    A NoteSequence.\n\n  Raises:\n    MIDIConversionError: An improper MIDI mode was supplied.\n  \"\"\"\n  # In practice many MIDI files cannot be decoded with pretty_midi. Catch all\n  # errors here and try to log a meaningful message. So many different\n  # exceptions are raised in pretty_midi.PrettyMidi that it is cumbersome to\n  # catch them all only for the purpose of error logging.\n  # pylint: disable=bare-except\n  if isinstance(midi_data, pretty_midi.PrettyMIDI):\n    midi = midi_data\n  else:\n    try:\n      midi = pretty_midi.PrettyMIDI(io.BytesIO(midi_data))\n    except:\n      raise MIDIConversionError('Midi decoding error %s: %s' %\n                                (sys.exc_info()[0], sys.exc_info()[1]))\n  # pylint: enable=bare-except\n\n  sequence = music_pb2.NoteSequence()\n\n  # Populate header.\n  sequence.ticks_per_quarter = midi.resolution\n  sequence.source_info.parser = music_pb2.NoteSequence.SourceInfo.PRETTY_MIDI\n  sequence.source_info.encoding_type = (\n      music_pb2.NoteSequence.SourceInfo.MIDI)\n\n  # Populate time signatures.\n  for midi_time in midi.time_signature_changes:\n    time_signature = sequence.time_signatures.add()\n    time_signature.time = midi_time.time\n    time_signature.numerator = midi_time.numerator\n    try:\n      # Denominator can be too large for int32.\n      time_signature.denominator = midi_time.denominator\n    except ValueError:\n      raise MIDIConversionError('Invalid time signature denominator %d' %\n                                midi_time.denominator)\n\n  # Populate key signatures.\n  for midi_key in midi.key_signature_changes:\n    key_signature = sequence.key_signatures.add()\n    key_signature.time = midi_key.time\n    key_signature.key = midi_key.key_number % 12\n    midi_mode = midi_key.key_number // 12\n    if midi_mode == 0:\n      key_signature.mode = key_signature.MAJOR\n    elif midi_mode == 1:\n      key_signature.mode = key_signature.MINOR\n    else:\n      raise MIDIConversionError('Invalid midi_mode %i' % midi_mode)\n\n  # Populate tempo changes.\n  tempo_times, tempo_qpms = midi.get_tempo_changes()\n  for time_in_seconds, tempo_in_qpm in zip(tempo_times, tempo_qpms):\n    tempo = sequence.tempos.add()\n    tempo.time = time_in_seconds\n    tempo.qpm = tempo_in_qpm\n\n  # Populate notes by gathering them all from the midi's instruments.\n  # Also set the sequence.total_time as the max end time in the notes.\n  midi_notes = []\n  midi_pitch_bends = []\n  midi_control_changes = []\n  for num_instrument, midi_instrument in enumerate(midi.instruments):\n    # Populate instrument name from the midi's instruments\n    if midi_instrument.name:\n      instrument_info = sequence.instrument_infos.add()\n      instrument_info.name = midi_instrument.name\n      instrument_info.instrument = num_instrument\n    for midi_note in midi_instrument.notes:\n      if not sequence.total_time or midi_note.end > sequence.total_time:\n        sequence.total_time = midi_note.end\n      midi_notes.append((midi_instrument.program, num_instrument,\n                         midi_instrument.is_drum, midi_note))\n    for midi_pitch_bend in midi_instrument.pitch_bends:\n      midi_pitch_bends.append(\n          (midi_instrument.program, num_instrument,\n           midi_instrument.is_drum, midi_pitch_bend))\n    for midi_control_change in midi_instrument.control_changes:\n      midi_control_changes.append(\n          (midi_instrument.program, num_instrument,\n           midi_instrument.is_drum, midi_control_change))\n\n  for program, instrument, is_drum, midi_note in midi_notes:\n    note = sequence.notes.add()\n    note.instrument = instrument\n    note.program = program\n    note.start_time = midi_note.start\n    note.end_time = midi_note.end\n    note.pitch = midi_note.pitch\n    note.velocity = midi_note.velocity\n    note.is_drum = is_drum\n\n  for program, instrument, is_drum, midi_pitch_bend in midi_pitch_bends:\n    pitch_bend = sequence.pitch_bends.add()\n    pitch_bend.instrument = instrument\n    pitch_bend.program = program\n    pitch_bend.time = midi_pitch_bend.time\n    pitch_bend.bend = midi_pitch_bend.pitch\n    pitch_bend.is_drum = is_drum\n\n  for program, instrument, is_drum, midi_control_change in midi_control_changes:\n    control_change = sequence.control_changes.add()\n    control_change.instrument = instrument\n    control_change.program = program\n    control_change.time = midi_control_change.time\n    control_change.control_number = midi_control_change.number\n    control_change.control_value = midi_control_change.value\n    control_change.is_drum = is_drum\n\n  # TODO(douglaseck): Estimate note type (e.g. quarter note) and populate\n  # note.numerator and note.denominator.\n\n  return sequence",
      "asOf": "2026-11-20"
    },
    "F197": {
      "label": "Project source file, pretty-midi",
      "display": "note_seq/midi_io.py",
      "asOf": "2026-11-20"
    },
    "F198": {
      "label": "Project full_name, pretty-midi",
      "display": "magenta/note-seq",
      "asOf": "2026-11-20"
    },
    "F199": {
      "label": "Project stargazers_count, pretty-midi",
      "display": "237",
      "asOf": "2026-11-20"
    },
    "F200": {
      "label": "Library name, symusic",
      "display": "Symusic",
      "asOf": "2026-11-20"
    },
    "F201": {
      "label": "Monthly downloads, symusic",
      "display": "463.8K",
      "asOf": "2026-11-20"
    },
    "F202": {
      "label": "License, symusic",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F203": {
      "label": "Package release, symusic",
      "display": "0.6.0",
      "asOf": "2026-11-20"
    },
    "F204": {
      "label": "Package release date, symusic",
      "display": "Apr 2026",
      "asOf": "2026-11-20"
    },
    "F205": {
      "label": "Install, symusic",
      "display": "python -m pip install symusic",
      "asOf": "2026-11-20"
    },
    "F206": {
      "label": "Quickstart, symusic",
      "display": "from symusic import Score\nscore = Score('example.mid')\nprint(score.tpq)\n",
      "asOf": "2026-11-20"
    },
    "F207": {
      "label": "Official description, symusic",
      "display": "Parses MIDI files through a high-performance interface.",
      "asOf": "2026-11-20"
    },
    "F208": {
      "label": "Quickstart source file, symusic",
      "display": "README.md",
      "asOf": "2026-11-20"
    },
    "F209": {
      "label": "Repository stars, symusic",
      "display": "190",
      "asOf": "2026-11-20"
    },
    "F210": {
      "label": "Read MIDI event model, symusic",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F211": {
      "label": "Write MIDI files, symusic",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F212": {
      "label": "Live MIDI ports, symusic",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F213": {
      "label": "Musical model, symusic",
      "display": "Compiled note-level MIDI/ABC graph",
      "asOf": "2026-11-20"
    },
    "F214": {
      "label": "Time modes, symusic",
      "display": "tick, quarter, or second units",
      "asOf": "2026-11-20"
    },
    "F215": {
      "label": "Formats and synthesis, symusic",
      "display": "MIDI/ABC export plus SoundFont synthesis APIs",
      "asOf": "2026-11-20"
    },
    "F216": {
      "label": "Declared Python requirement, symusic",
      "display": ">=3.9",
      "asOf": "2026-11-20"
    },
    "F217": {
      "label": "Project function, symusic",
      "display": "def split_score_per_tracks(score: Score) -> list[Score]:\n    \"\"\"\n    Split a ``symusic.Score`` into several scores for each of its tracks.\n\n    The split scores will all start at tick 0.\n    Example: for a score with an end tick at 1000, and a list of tick\n    ``[2000, 5000, 7000]``, this method will return a list of four scores which\n    correspond respectively to the portions of the original score from tick 0 to 2000,\n    2000 to 5000, 5000 to 7000 and 10000 to 10000.\n\n    :param score: ``symusic.Score`` object to split.\n    :return: a list of split ``symusic.Score`` objects.\n    \"\"\"\n    scores_split = []\n    for track in score.tracks:\n        score_split = Score(score.tpq)\n        score_split.tempos = score.tempos\n        score_split.time_signatures = score.time_signatures\n        score_split.key_signatures = score.key_signatures\n        score_split.markers = score.markers\n        score_split.tracks.append(track.copy())\n\n        scores_split.append(score_split)\n    return scores_split",
      "asOf": "2026-11-20"
    },
    "F218": {
      "label": "Project source file, symusic",
      "display": "src/miditok/utils/split.py",
      "asOf": "2026-11-20"
    },
    "F219": {
      "label": "Project full_name, symusic",
      "display": "Natooz/MidiTok",
      "asOf": "2026-11-20"
    },
    "F220": {
      "label": "Project stargazers_count, symusic",
      "display": "908",
      "asOf": "2026-11-20"
    },
    "F221": {
      "label": "Library name, basic-pitch",
      "display": "Basic Pitch",
      "asOf": "2026-11-20"
    },
    "F222": {
      "label": "Monthly downloads, basic-pitch",
      "display": "396.1K",
      "asOf": "2026-11-20"
    },
    "F223": {
      "label": "License, basic-pitch",
      "display": "Apache-2.0",
      "asOf": "2026-11-20"
    },
    "F224": {
      "label": "Package release, basic-pitch",
      "display": "0.4.0",
      "asOf": "2026-11-20"
    },
    "F225": {
      "label": "Package release date, basic-pitch",
      "display": "Aug 2024",
      "asOf": "2026-11-20"
    },
    "F226": {
      "label": "Install, basic-pitch",
      "display": "python -m pip install basic-pitch",
      "asOf": "2026-11-20"
    },
    "F227": {
      "label": "Quickstart, basic-pitch",
      "display": "from basic_pitch.inference import predict\nmodel_output, midi_data, note_events = predict('example.wav')\nprint(len(note_events))\n",
      "asOf": "2026-11-20"
    },
    "F228": {
      "label": "Official description, basic-pitch",
      "display": "Converts audio to MIDI and detects pitch bends.",
      "asOf": "2026-11-20"
    },
    "F229": {
      "label": "Quickstart source file, basic-pitch",
      "display": "basic_pitch/inference.py",
      "asOf": "2026-11-20"
    },
    "F230": {
      "label": "Repository stars, basic-pitch",
      "display": "6.1K",
      "asOf": "2026-11-20"
    },
    "F231": {
      "label": "Read MIDI event model, basic-pitch",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F232": {
      "label": "Write MIDI files, basic-pitch",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F233": {
      "label": "Live MIDI ports, basic-pitch",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F234": {
      "label": "Task, basic-pitch",
      "display": "Audio-to-MIDI transcription with pitch-bend detection",
      "asOf": "2026-11-20"
    },
    "F235": {
      "label": "Input separation, basic-pitch",
      "display": "Works best on one instrument at a time",
      "asOf": "2026-11-20"
    },
    "F236": {
      "label": "Output dependency, basic-pitch",
      "display": "Uses pretty_midi for MIDI representation/export",
      "asOf": "2026-11-20"
    },
    "F237": {
      "label": "Project function, basic-pitch",
      "display": "def extractMIDI(audio_paths, output_dir):\n    print('- Extract Midi')\n    save_midi = True\n    sonify_midi = False\n    save_model_outputs = False\n    save_notes = False\n\n    predict_and_save(audio_path_list=audio_paths, \n                  output_directory=output_dir, \n                  save_midi=save_midi, \n                  sonify_midi=sonify_midi, \n                  save_model_outputs=save_model_outputs, \n                  save_notes=save_notes)",
      "asOf": "2026-11-20"
    },
    "F238": {
      "label": "Project source file, basic-pitch",
      "display": "polymath.py",
      "asOf": "2026-11-20"
    },
    "F239": {
      "label": "Project full_name, basic-pitch",
      "display": "samim23/polymath",
      "asOf": "2026-11-20"
    },
    "F240": {
      "label": "Project stargazers_count, basic-pitch",
      "display": "1.6K",
      "asOf": "2026-11-20"
    },
    "F241": {
      "label": "Library name, python-rtmidi",
      "display": "python-rtmidi",
      "asOf": "2026-11-20"
    },
    "F242": {
      "label": "Monthly downloads, python-rtmidi",
      "display": "207.1K",
      "asOf": "2026-11-20"
    },
    "F243": {
      "label": "License, python-rtmidi",
      "display": "MIT",
      "asOf": "2026-11-20"
    },
    "F244": {
      "label": "Package release, python-rtmidi",
      "display": "1.5.8",
      "asOf": "2026-11-20"
    },
    "F245": {
      "label": "Package release date, python-rtmidi",
      "display": "Nov 2023",
      "asOf": "2026-11-20"
    },
    "F246": {
      "label": "Install, python-rtmidi",
      "display": "python -m pip install python-rtmidi",
      "asOf": "2026-11-20"
    },
    "F247": {
      "label": "Quickstart, python-rtmidi",
      "display": "import rtmidi\nmidiout = rtmidi.MidiOut()\ntry:\n    print(midiout.get_ports())\nfinally:\n    midiout.delete()\n",
      "asOf": "2026-11-20"
    },
    "F248": {
      "label": "Official description, python-rtmidi",
      "display": "Binds the RtMidi C++ library to Python with Cython.",
      "asOf": "2026-11-20"
    },
    "F249": {
      "label": "Quickstart source file, python-rtmidi",
      "display": "doc/rtmidi.rst",
      "asOf": "2026-11-20"
    },
    "F250": {
      "label": "Repository stars, python-rtmidi",
      "display": "417",
      "asOf": "2026-11-20"
    },
    "F251": {
      "label": "Read MIDI event model, python-rtmidi",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F252": {
      "label": "Write MIDI files, python-rtmidi",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F253": {
      "label": "Live MIDI ports, python-rtmidi",
      "display": "Yes",
      "asOf": "2026-11-20"
    },
    "F254": {
      "label": "Task, python-rtmidi",
      "display": "Platform MIDI message input/output",
      "asOf": "2026-11-20"
    },
    "F255": {
      "label": "Port identity, python-rtmidi",
      "display": "Enumeration yields names under a selected compiled API",
      "asOf": "2026-11-20"
    },
    "F256": {
      "label": "Declared Python requirement, python-rtmidi",
      "display": ">=3.8",
      "asOf": "2026-11-20"
    },
    "F257": {
      "label": "Project function, python-rtmidi",
      "display": "def get_devices(api=None, **kwargs):\n    devices = {}\n\n    rtapi = _get_api_id(api)\n\n    mi = rtmidi.MidiIn(rtapi=rtapi)\n    mo = rtmidi.MidiOut(rtapi=rtapi)\n    input_names = mi.get_ports()\n    output_names = mo.get_ports()\n\n    for name in input_names + output_names:\n        if name not in devices:\n            devices[name] = {\n                'name': name,\n                'is_input': name in input_names,\n                'is_output': name in output_names,\n            }\n\n    mi.delete()\n    mo.delete()\n    return list(devices.values())",
      "asOf": "2026-11-20"
    },
    "F258": {
      "label": "Project source file, python-rtmidi",
      "display": "mido/backends/rtmidi.py",
      "asOf": "2026-11-20"
    },
    "F259": {
      "label": "Project full_name, python-rtmidi",
      "display": "mido/mido",
      "asOf": "2026-11-20"
    },
    "F260": {
      "label": "Project stargazers_count, python-rtmidi",
      "display": "1.7K",
      "asOf": "2026-11-20"
    },
    "F261": {
      "label": "Library name, essentia",
      "display": "Essentia",
      "asOf": "2026-11-20"
    },
    "F262": {
      "label": "Monthly downloads, essentia",
      "display": "116.3K",
      "asOf": "2026-11-20"
    },
    "F263": {
      "label": "License, essentia",
      "display": "AGPL-3.0-only",
      "asOf": "2026-11-20"
    },
    "F264": {
      "label": "Package release, essentia",
      "display": "2.1b6.dev1438",
      "asOf": "2026-11-20"
    },
    "F265": {
      "label": "Package release date, essentia",
      "display": "May 2026",
      "asOf": "2026-11-20"
    },
    "F266": {
      "label": "Install, essentia",
      "display": "python -m pip install essentia==2.1b6.dev1438",
      "asOf": "2026-11-20"
    },
    "F267": {
      "label": "Quickstart, essentia",
      "display": "import numpy as np\nfrom essentia.standard import Audio2Midi\ndetector = Audio2Midi(hopSize=32)\nresult = detector(np.zeros(32, dtype=np.float32))\nprint(result[2:])\n",
      "asOf": "2026-11-20"
    },
    "F268": {
      "label": "Official description, essentia",
      "display": "Analyzes, describes, and synthesizes audio and music.",
      "asOf": "2026-11-20"
    },
    "F269": {
      "label": "Quickstart source file, essentia",
      "display": "Audio2Midi algorithm reference",
      "asOf": "2026-11-20"
    },
    "F270": {
      "label": "Repository stars, essentia",
      "display": "3.8K",
      "asOf": "2026-11-20"
    },
    "F271": {
      "label": "Read MIDI event model, essentia",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F272": {
      "label": "Write MIDI files, essentia",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F273": {
      "label": "Live MIDI ports, essentia",
      "display": "No",
      "asOf": "2026-11-20"
    },
    "F274": {
      "label": "Native MIDI operation, essentia",
      "display": "Stateful audio-frame to note-on/off detection",
      "asOf": "2026-11-20"
    },
    "F275": {
      "label": "Return values, essentia",
      "display": "Five outputs include message types and timing compensation",
      "asOf": "2026-11-20"
    },
    "F276": {
      "label": "Scope of counter, essentia",
      "display": "Broader audio/MIR distribution with a native MIDI detector",
      "asOf": "2026-11-20"
    }
  },
  "dataCheckedAt": "2026-11-20",
  "agent": {
    "exaCall": {
      "endpoint": "/search",
      "body": {
        "query": "Best Python music libraries Mido pretty_midi Miditoolkit music21 code examples",
        "numResults": 5
      },
      "docsUrl": "https://exa.ai/docs/reference/search"
    },
    "calls": []
  }
}
