Fixes to audio attenuation jumps and better sample loop script

this comment appears to be in the wrong place. makes the code confusing to read.