                 print("Error: No audio tracks found")
                 return 0
             }
+            
             let outputSettings: [String:Int] =
                 [   AVFormatIDKey: Int(kAudioFormatLinearPCM),
                     AVLinearPCMIsBigEndianKey: 0,                   /// little endian

                    sampleChannels = Int32(desc.mChannelsPerFrame)
                }
            }
            /// Sanity check
            guard (sampleRate != nil) && (sampleChannels != nil) else {
                return 0

            let audioTrack = audioTracks[0]
            let trackOutput = AVAssetReaderTrackOutput(track: audioTrack, outputSettings: outputSettings)

            /// Get the duration.
            let durationInSeconds = CMTimeGetSeconds(audioTrack.timeRange.duration)

            var sampleRate : Int32?
            var sampleChannels : Int32?
            let descriptions = audioTrack.formatDescriptions
            
            for d in 0..<descriptions.count {
                let item = descriptions[d] as! CMAudioFormatDescriptionRef
                let desc = CMAudioFormatDescriptionGetStreamBasicDescription(item).memory
