     //AVAudioEngine and nodes
     internal var engine: AVAudioEngine = AVAudioEngine()
     internal var player: AVAudioPlayerNode = AVAudioPlayerNode()
-    
+    internal let mixer: AVAudioMixerNode = AVAudioMixerNode()
+
     //audio file
     internal var audioFile: AVAudioFile?
     

    }
    
    public func stop() {
        guard isPlaying() else {
            return
        }
                
        _stop()
        
        DispatchQueue.main.async {
            self.delegate?.playbackStopped(trackCompleted: self.reachedEnd)
        }
    }
    


        //attach nodes
        engine.attach(player)
        engine.attach(mixer)
        
        //connect nodes
        // IMPORTANT: The mixer is used to abstract away
        // file format (channel count, sample rate) config from
        // other processing nodes which may want to connect to this stream
        // subclasses can connect to the mixer which is configured for file format.
        engine.connect(player, to: mixer, format: nil)
        engine.connect(mixer, to: engine.mainMixerNode, format: nil)

        engine.prepare()
    }
    
    //ensure output format of player matches format of the file
    //not doing this can cause crashes when channel counts don't match
    //and can cause sample rate mismatches which impact playback speed
    internal func matchFilePlaybackFormat(_ fileFormat: AVAudioFormat) {
        let outputFormat = engine.mainMixerNode.outputFormat(forBus: 0)
        let playbackFormat = AVAudioFormat(commonFormat: outputFormat.commonFormat,
                                           sampleRate: fileFormat.sampleRate,
                                           channels: fileFormat.channelCount,
                                           interleaved: outputFormat.isInterleaved)
        
        engine.connect(player, to: mixer, format: playbackFormat)
        
        //prepare the engine
        engine.prepare()
    }

    //MARK: Public Methods
    @discardableResult public func setTrack(url: URL) -> Bool {
        guard let file = try? AVAudioFile.init(forReading: url) else {
