meta_events.py 文件源码

python
阅读 24 收藏 0 点赞 0 评论 0

项目:midi 作者: MicroTransactionsMatterToo 项目源码 文件源码
def key_signature(data: Union[FileIO, BufferedReader]) -> Tuple[int, Tuple[int, int], bytearray]:
    length_bytes = bytearray(data.read(1))
    length = int.from_bytes(length_bytes, "big")

    if length != 0x02:
        raise EventLengthError("Key Signature event has invalid length. Should be 2, value was {}".format(length))

    data_bytes = bytearray(data.read(2))
    signature_index = data_bytes[0]
    minor_major = data_bytes[1]

    return length, (signature_index, minor_major), data_bytes
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号