             return 
         }
         
+        
         let chunkSize: Int = watsonFrameSize * 2
         var offset : Int = 0
         
         var ptr = UnsafeMutablePointer<UInt8>(buffer.mAudioData)
         
-        repeat {
-        
-            let thisChunkSize = length - offset > chunkSize ? chunkSize : length - offset
-            ptr += offset
-            
-            let chunk = NSData(bytesNoCopy: ptr, length: thisChunkSize, freeWhenDone: false)
-            
-            let compressed = data.opusEncoder.encode(chunk, frameSize: Int32(watsonFrameSize))
-            
-            if compressed.length != 0 {
-                // Log.sharedLogger.info("Compressed the packet")
-                
-                let newData = data.oggEncoder.writePacket(compressed, frameSize: Int32(watsonFrameSize))
-                
-                if newData != nil {
-                    // Log.sharedLogger.info("Wrote an OGG packet")
-                    
-                        if let socket = data.socket {
-                            
-                            Log.sharedLogger.info("Added the audio to the queue")
-                            let o1 = AudioUploadOperation(data: newData, socket: socket)
-                            data.audioUploadQueue.addOperation(o1)
-                        } else {
-                            
-                            Log.sharedLogger.warning("Could not get handle to socket")
-                            
-                        }
-        
-                    
-                    
-                }
-            }
-            
-            offset += thisChunkSize
-        
-        } while offset < length
-        
+        let newData = NSData(bytesNoCopy: ptr, length: Int(buffer.mAudioDataByteSize), freeWhenDone: false)
+        
+        Log.sharedLogger.info("Added the audio to the queue")
+        //let o1 = AudioUploadOperation(data: newData, socket: data.socket!)
+        //data.audioUploadQueue.addOperation(o1)
         
         
         // Tell the buffer it's free to accept more data

            isRunning: true,
            opusEncoder: opus,
            oggEncoder: ogg,
            audioUploadQueue: audioUploadQueue,
            socket: socket
        )
        
        AudioQueueNewInput(&audioState.dataFormat, recordCallback, &audioState,

//            AudioQueueBufferRef(),
//            AudioQueueBufferRef()]
        
        // connectWebsocket()
        
        let format = AudioStreamBasicDescription(
            mSampleRate: 16000,
