DE3: Broke calculation and writing into separate parts for memory conservation, as the attack calculation loop was using up too much memory when done at once.  Included is a fix for DE2, the number of samples was not calculated correctly.