Leaqio.com
colugomusic from patreon
colugomusic patreon

Dev log #28 - Song traversal (warning very boring)

🕑 Added 2020-11-24 15:37:42 +0000 UTC

Comments

Colugo Music

Blockhead calculates the current sample position from scratch each frame using the same algorithm the waveform renderer uses, rather than incrementing a value each frame, so there shouldn't be any drift there unless you mean something else

Marek Bereza

Makes sense - you probably know this but if you have a float32 playhead in any sample playback, it's likely to drift and make things go out of tune, that bit me on the butt a few years ago!

Colugo Music

I thought of doubles too but the library I use to handle SIMD things (madronalib) only supports float vectors so they would need to be vectorized to float anyway. One problem with splitting it in two is the song position can be manipulated by the UI thread directly (unless I start shoving that into a queue). I made a class that encodes the int32 and float32 into a single int64 which can be updated atomically

Marek Bereza

can you just use doubles? Does that still cause you to run into precision problems? I used to be scared of doubles for performance, but most CPU's seem to crunch them as fast as 32 bit floats (SIMD aside). The idea you're suggesting (split the whole and fractional parts) sounds a bit like Q-notation which is used more in embedded stuff that doesn't have an FPU, which has uniform precision rather than float's very wonky precision, and with some cleverness, you can actually almost do maths directly on them


More Creators