The file is corrupted before being written, as you can see in the diagram (of the audio in memory). I simply exported to listen to it. The writing is working perfectly. The problem is with the reading somewhere. I've been working on this for the passed day, I'll keep you updated on my progress.
If you look in unpackBits there's int i = s * bytesPerSample;. I've multiplied the sample index by the amount of bits for this sample, so the boundaries are aligned.
decode is not called in a loop. It's fed the full array of sample data, once. The javadocs are dated (I've altered the code from the original post - sorry about the confusion. With the original post, the same issue occurs - so I don't think it's to do with my changes.
m creating a fractal visualisation.
I want the colour per point to be based off the iteration final value, f(zn), instead of the traditional: number of iterations before reaching a cut-off (usually when any component, real or imaginary, of z is >2).
How could I from from something like:
0, 1, ...