Skip to content

7Byte in 8Byte packet, Lexicon LXP-1 #595

Answered by dnaldoog
Tonfisch asked this question in Q&A
Discussion options

You must be logged in to vote

I haven't looked deeply at it because it's a head wreck all this packed bit stuff, but I think it's the same logic as with Korg and how they do it.

But I have two functions that can convert such data - you may have to change things in these functions. They return memory blocks of 8 or 7 bits depending which way you're going.

function convert728(m) -- take a set of 7 bytes - extract the msbit and save to byte 0 of 8 bytes
    assert(m:getSize() == 7)
    local b, t = {1, 2, 4, 8, 16, 32, 64}, {}
    local msb = {}
    local lsb = {}
    local mlsb = MemoryBlock()

    for i = 0, m:getSize() - 1 do -- loop each byte
        local mask = bit.rshift(bit.band(m:getByte(i), 128), 7)
        msb…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Tonfisch
Comment options

You must be logged in to vote
1 reply
@Tonfisch
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@dnaldoog
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants