I was writing data to a 12-bit DAC I have never used before that was acting funny - the waveform was all distorted. Thinking that it was a SPI data format problem, I first changed the code to write a sawtooth wave (all 12-bit words from 0 to 4095) in ~680ms (6kHz update rate, with a super slow SPI clock speed to make sure it wasn’t a clock integrity problem). Here’s what I saw on the scope:
I finally identified the problem (a clock polarity problem) and fixed it, but I’m fascinated by this shape. I have tried various bit shifting / mangling equations that would simulate what would happen with the misaligned SPI data, but I cannot reproduce it - I believe the shift register of the DAC behavior is weird and stateful when you try to clock it with the wrong polarity.
Observing the fractal structure of the thing, I found a recursive function that produces a similar-looking output, but I’m not convinced with it - it still doesn’t tell me what’s going on. Anybody has a better idea as to what’s going on here and how to simulate this without recursion and just a bunch of bit-mangling operations?
This looks like the ultimate destructive waveshaping function, since it produces mess/distortion at all scales for any kind of input.
Fascinating shape, looks like a fractal or an automata - I would definitely thought some recursion is going on.
How the hell did you figure out what function it was though, did you reverse engineer the bug?
This thing obviously has a fractal structure that seems to be described by the recipe:
Take a graph A.
Split it into two segments A1 and A2.
Append A1 to A to yield A’
Append A2 translated up to A’ to yield A" (A" = A1 . A2 . A1 . (A2 shifted up)).
Repeat the process on A"
I got the recursive function just by trying that.
It looked similar but I wasn’t convinced about it - the whole process had many dependencies between bits. I started to think about something more string-like and “serial”, and thought that there was a particular bit-pattern the shift register was choking on.
I’d be surprised if us mere mortals could figure out in a month of sundays what it took you to work out in a mere 18 minutes! Ha…
Although when I saw it, I thought “Hmm, looks kinda like a fractal…” And that was as far as I got.
But on that note, I was going to end the post with "Fractal synthesis! You heard it here first at Mutable Instruments I’ll bet none take this form though…