     let desktopPath = "/Users/teo/Desktop/"
 //    let fileName = "64.mp3"
 //    let fileName = "low.wav"
-//    let fileName = "64.wav"
-        let fileName = "small64.m4a"
+    let fileName = "64.wav"
+//        let fileName = "small64.m4a"
     
     func applicationDidFinishLaunching(aNotification: NSNotification) {
 
-        let maxLength = 120
+        let maxLength = 1200
         /** Create a single instance of an unsafe mutable Int8 pointer so we can 
             pass it to chromaprint_get_fingerprint without errors. 
             The defer ensures it is not leaked.

            
            let sampleData      = NSMutableData()
            var totalBuf: Int = 0
            /// start off chromaprint
            chromaprint_start(context, sampleRate!, sampleChannels!)
            
            while reader.status == AVAssetReaderStatus.Reading {
                if let sampleBufferRef = trackOutput.copyNextSampleBuffer() {
                    if let blockBufferRef = CMSampleBufferGetDataBuffer(sampleBufferRef) {
                        /**
                        size_t lengthAtOffset;
                        size_t totalLength;
                        char* data;

*/
//                        var lengthAtOffset = 0
//                        var totalLength = 0
//                        var dataPointer = UnsafeMutablePointer<Int8>.alloc(1)
//                        defer {
//                            dataPointer.destroy()
//                            dataPointer.dealloc(1)
//                        }
//
//                        if CMBlockBufferGetDataPointer(blockBufferRef,
//                            0,                  /// start from offset zero
//                            &lengthAtOffset,    /// will be set to bytelength from above offset
//                            &totalLength,       /// will be set to bytelength from offset 0
//                            &dataPointer) == kCMBlockBufferNoErr {
//                            print("Datapointer \(dataPointer), \(lengthAtOffset), \(totalLength)")
//                                for idx in 0..<totalLength {
//                                    print(String(format:"%X", dataPointer[idx]))
//                                }
//                        }
                        
                        /// bufferLength is the total number of bytes in the buffer
                        let bufferLength = CMBlockBufferGetDataLength(blockBufferRef)
                        totalBuf += bufferLength
                        

    func decodeAudio(
        fromUrl: NSURL,
        withMaxLength maxLength: Int ,
        forContext context: UnsafeMutablePointer<ChromaprintContext>) -> Double {
        
            let asset = AVURLAsset(URL: fromUrl)
            let reader = try! AVAssetReader(asset: asset)
            let audioTracks = asset.tracksWithMediaType(AVMediaTypeAudio)
            
            if audioTracks.count == 0 {
                print("Error: No audio tracks found")
                return 0
