     var velocityToSend:Int? {
         return Int(noteVelField.text!)
     }
+    var noteChanToSend:Int? {
+        return Int(noteChanField.text!)
+    }
     var ccToSend:Int? {
         return Int(ccField.text!)
     }
     var ccValToSend:Int? {
         return Int(ccValField.text!)
     }
+    var ccChanToSend:Int? {
+        return Int(ccChanField.text!)
+    }
+    var sysexToSend:[Int]?{
+        var data = [Int]()
+        if sysexField.text == nil {
+            return nil
+        }
+        let splitField = sysexField.text!.components(separatedBy: " ")
+        for entry in splitField {
+            let intVal = Int(entry)
+            if intVal != nil {
+                data.append(intVal!)
+            }
+        }
+        return data
+    }
     override func viewDidLoad() {
-        
         midiOut.openOutput()
-        
-        //Looks for single or multiple taps.
         let tap: UITapGestureRecognizer = UITapGestureRecognizer(target: self, action: #selector(dismissKeyboard))
-        //Uncomment the line below if you want the tap not not interfere and cancel other interactions.
-        //tap.cancelsTouchesInView = false
         view.addGestureRecognizer(tap)
     }
     
-    
-    //Calls this function when the tap is recognized.
     @objc func dismissKeyboard() {
-        //Causes the view (or one of its embedded text fields) to resign the first responder status.
         view.endEditing(true)
     }
     
     @IBAction func sendNotePressed(_ sender: UIButton) {
-        if noteToSend != nil && velocityToSend != nil {
+        if noteToSend != nil && velocityToSend != nil && noteChanToSend != nil {
             print("sending note: \(noteToSend!) - \(velocityToSend!)")
-            let event = AKMIDIEvent(noteOn: MIDINoteNumber(noteToSend!), velocity: MIDIVelocity(velocityToSend!), channel: 0)
+            let event = AKMIDIEvent(noteOn: MIDINoteNumber(noteToSend!), velocity: MIDIVelocity(velocityToSend!), channel: MIDIChannel(noteChanToSend!))
             midiOut.sendEvent(event)
         }else{
             print("error w note fields")
         }
     }
     @IBAction func sendCCPressed(_ sender: UIButton) {
-        if ccToSend != nil && ccValToSend != nil {
+        if ccToSend != nil && ccValToSend != nil && ccChanToSend != nil {
             print("sending cc: \(ccToSend!) - \(ccValToSend!)")
-            let event = AKMIDIEvent(controllerChange: MIDIByte(ccToSend!), value: MIDIByte(ccValToSend!), channel: 1)
+            let event = AKMIDIEvent(controllerChange: MIDIByte(ccToSend!), value: MIDIByte(ccValToSend!), channel: MIDIChannel(ccChanToSend!))
             midiOut.sendEvent(event)
         }else{
             print("error w cc fields")

    }
    
    @IBAction func sendSysexPressed(_ sender: UIButton) {
        print("sending sysex")
    }
    
    @IBAction func receiveMIDIButtonPressed(_ sender: UIButton) {

    
    @IBOutlet var noteNumField: UITextField!
    @IBOutlet var noteVelField: UITextField!
    @IBOutlet var noteChanField: UITextField!
    @IBOutlet var ccField: UITextField!
    @IBOutlet var ccValField: UITextField!
    @IBOutlet var ccChanField: UITextField!
    @IBOutlet var sysexField: UITextView!
    
    var noteToSend:Int? {
