Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(9)  |  Call(8)  |  Derive(0)  |  Import(1)
Turns a string into a list of byte values

        def toBytes(value):
    "Turns a string into a list of byte values"
    return unpack('%sB' % len(value), value)

src/c/a/canta-HEAD/canta/midi/EventDispatcher.py   canta(Download)
# custom
from DataTypeConverters import readBew, readVar, varLen, toBytes
# uhh I don't really like this, but there are so many constants to 
        stream = self.outstream
        data = toBytes(data)
        if (NOTE_ON & 0xF0) == hi_nible:
        elif common_type == SONG_POSITION_POINTER:
            hibyte, lobyte = toBytes(common_data)
            value = (hibyte<<7) + lobyte
        # TEMPO = 0x51 (51 03 tt tt tt (tempo in us/quarternote))
        elif meta_type == TEMPO:
            b1, b2, b3 = toBytes(data)
            # uses 3 bytes to represent time between quarter 
            # notes in microseconds
            stream.tempo((b1<<16) + (b2<<8) + b3)
        # SMTP_OFFSET = 0x54 (54 05 hh mm ss ff xx)
        elif meta_type == SMTP_OFFSET:
            hour, minute, second, frame, framePart = toBytes(data)