let sourceBuffer = UnsafeBufferPointer<Int16>(start: head.assumingMemoryBound(to: Int16.self), count: bufferLength) // Copy samples to AVAudioPCMBuffer for channel in 0..<channelCount { let samples = UnsafeMutableBufferPointer<Float32>(start: destinationBuffer.floatChannelData?.pointee, count: bufferLength) for frame in 0..<frameLength { // Cast 16bit audio to 32bit samples[frame] = Float32(audioBuffer[frame * channelCount + channel]) } } AUDIO