                  noiseFloor: noiseFloor)
         
         if !displayInDB {
-            //convert DB to gain/power and clip at the specified dynamic range
-            //TODO: accelerate this?
+            //convert DB to gain/power and (re-)clip at the specified dynamic range
             samples = samples.map { pow(10.0, $0/20.0) }
             var floor: Float = 0.0
             var ceil: Float = abs(noiseFloor)

            var zero: Float = 1;
            vDSP_vdbcon(samples, 1, &zero, &samples, 1, sampleCount, 1);
            
            // clip at noise floor
            var floor: Float = noiseFloor
            var ceil: Float = 0.0
            vDSP_vclip(samples, 1, &floor, &ceil, &samples, 1, sampleCount);
            
            //decimate samples
            vDSP_desamp(samples,
                        vDSP_Stride(samplesPerPixel),

            //operating in place and trimming buffer is better on memory and slightly faster than duplicating data
            samples.removeLast(samples.count - downSampledLength)
            
            // clip at noise floor then
            // add noisefloor to make values positive amplitude in db
            var floor: Float = noiseFloor
            var ceil: Float = 0.0
            vDSP_vclip(samples, 1, &floor, &ceil, &samples, 1, vDSP_Length(samples.count));
            vDSP.add(abs(noiseFloor), samples, result: &samples)
        }
        else {
