Okay maybe I should start by actually trying to describe what I want to achieve.
I’m preparing a pseudo-DJ set. I split my songs into 2 parts in Ableton Live to be super precise. First wav file most of the track and second file is usually a last part that can loop forever until i prepare a second track etc. Then using DigiChain I create a 2 slice sample chain out of these 2 files. I’m going through all this hassle to be super precise to the songs are always “on the beat”.
Essentially a higher level of what I wanto to achieve is this: song starts to play, plays until the end and loops the last section i chose earlier “forever”.
Anyways, Obviously this way I was sacrificing 2 patterns, 1 for the main part and 2 for the “looped” last part of the track. Later I thought instead of using “slices” if I can precisely set the loop point of the audio, I can do the same with just 1 pattern.
So with a bash script I wrote (with great help from ChatGPT ofc) right now I grab the 2nd slice’s start point from the HEX dump of the ot file Digichain generated, and overwrite “loop start” with that value. This seems to work for the most part. When I load the associated wave to a static track slot, the file is loaded but I see an error dialog saying “sample load error!”. But when I check the audio file in AED, i can see i successfully set the loop start and everything normally works.
What I recognized later is: Octatrack seems to “fix” the attributes by itself. Because when I “save file attributes” on octatrack and compare the resulting ot file’s hex with “unmodified” ot file’s hex I realized Octatrack did some changes to “fix” the file. One of those changes is setting Loop to 0000 0001 (essentially loop “on”) and I feel like there’s smt like if loopStart != 0, then loop is true going on. and it also changes the “loop length”, because obviously, the length of the loops changes (assuming by default loop start = trim start, loop length = trim length).
so again, assuming my checksum calculation is correct, i think Octatrack is complaining because the “attributes” of the file does not match the other metadata (in this case, the “changed” loop start) initially when the file is loaded into a slot.
initially i assumed loop length should be in samples and i tried calculating loop length by subtracting slice 2 start point from slice 2 end point, but octatrack complained again AND changed loop length bytes after it “fixed” it. that’s why i think loop length is actually written in “bars”. OR maybe i didn’t to the byte inversion?
anyways, here’s my code (unfortunately an earlier version where I don’t have the loop length calculation, because the other file i’m working on got super messed up trying to calculate it in bars etc, it’s a big mess lol):
later i’ll try to post a more up-to-date version that has looplength calculation in samples if i’m able to clean up the other messy code (or maybe even start from scratch)