         setupAudioSession()
         disableAUIO()
 
-        engine.connect(engine.mainMixerNode, to: engine.outputNode, format: nil)
+        engine.connect(engine.mainMixerNode, to: engine.outputNode, format: generalFormat)
         engine.startAndReturnError(&error)
 
         if error != nil {

    func peerConnected(peerID: MCPeerID) {
        let playerDecoder = AudioPlayerDecoder()
        engine.attachNode(playerDecoder.audioPlayer)
        engine.connect(playerDecoder.audioPlayer, to: engine.mainMixerNode, format: nil)
        playerDecoder.audioPlayer.play()
        peerToOutput[peerID] = playerDecoder
    }

import AVFoundation
import MultipeerConnectivity

let generalFormat = AVAudioFormat(standardFormatWithSampleRate: 16000, channels: 1)

class AudioPlayerDecoder {
    let audioPlayer = AVAudioPlayerNode()
    let decoder: AudioQueueDecoder;
    let buffer = AVAudioPCMBuffer(PCMFormat: generalFormat, frameCapacity: 8196)

    init () {
        decoder = AudioQueueDecoder(format: buffer.format.streamDescription)
