Those two samples at the beginning are bothering me also, however seems to work ok for now, I’ll leave those on the list of things to come back to.
The length thing makes sense now, so I just need to have one long string and calculate it’s size in bytes. I also realised that the OP1 data is in JSON format so I can just use a LUA/JSON library which should make this bit easier.
The overall file length I hadn’t thought about but it has not been an issue so far, will see how far I get without touching it
I was also searching through Github and found a couple of projects where this mission has already been tackled.
https://github.com/padenot/libop1
https://github.com/operator1/op1/blob/master/op1/src/main/java/com/op1/util/DrumkitBuilder.java
This will maybe help with some of these issues I have found, I already figured that the sample slice points are based on the bytes in the sample data.