                            samplesToProcess: samplesToProcess,
                            downSampledLength: downSampledLength,
                            samplesPerPixel: samplesPerPixel,
-                           filter2: filter)
+                           filter: filter)
         }
         
         // if (reader.status == AVAssetReaderStatusFailed || reader.status == AVAssetReaderStatusUnknown)

        }

        var sampleMax = format.noiseFloor
        
        let sliceTotalSamples = channelCount * slice.count
//        let firstSamplesCount = (sliceTotalSamples / (targetSamples - 1)) * (targetSamples - 1)
//        let samplesPerPixel = firstSamplesCount / (targetSamples - 1)
        
//        print("firstSamplesCount: \(firstSamplesCount), samplesPerPixel: \(samplesPerPixel)")
        
        let lowerSamplesPerPixel = max(1, channelCount * slice.count / targetSamples)
        let sampleRemainder = sliceTotalSamples % targetSamples
        let filter = [Float]()//(repeating: 1.0 / Float(samplesPerPixel), count: samplesPerPixel)

        var outputSamples = [CGFloat]()
        var sampleBuffer = Data()
        
        var totalSampleCount = 0
        var sampleRemainderBucketCount = 0

        // 16-bit samples
        reader.startReading()

        let verticalMiddle = (imageSize.height * format.scale) / 2
        for (x, sample) in samples.enumerated() {
            let height = (sample - min) * sampleDrawingScale
            context.move(to: CGPoint(x: CGFloat(x), y: verticalMiddle - height))
            context.addLine(to: CGPoint(x: CGFloat(x), y: verticalMiddle + height))
            context.strokePath();
        }
        guard let image = UIGraphicsGetImageFromCurrentImageContext() else {
