<commit_before>var Midiplex = require('midiplex')
var es = require('event-stream')
var dgram = require('dgram')
var midi = require('midi')
var through = require('through')

function udpSocket() { return new dgram.createSocket('udp4') }

function udpStream(socket) {
  return es.readable(function(count, callback) {
    var self = this
    socket.on('message', function(buf){
      self.emit('data', buf)
      callback()
    })
  })
}
var mp = new Midiplex()

var modSocketX = udpSocket()
var velSocket = udpSocket()
var modSocketY = udpSocket()

var modXStream = udpStream(modSocketX)
var velStream = udpStream(velSocket)
var modYStream = udpStream(modSocketY)

mp.addControllerStream(modXStream, {maxVal: 127, controller: 1})
//mp.setVelocityStream(velStream, {maxVal: 200})
mp.addControllerStream(modYStream, {maxVal: 127, controller: 2})

modSocketX.bind(9001)
modSocketY.bind(9002)

var output = new midi.output()
console.log(output.getPortName(1))
output.openPort(1)
var midiStream = midi.createWriteStream(output)
mp.getReadableStream().pipe(midiStream)<commit_msg>Adjusted to use TCP<commit_after>var Midiplex = require('midiplex')
var midi = require('midi')
var through = require('through')
var net = require('net')

var mp = new Midiplex()

function controlServer(controlNum) {
  return net.createServer(function(stream) {
    mp.addControllerStream(stream, {maxVal: 127, controller: controlNum})
  })
}

var serverX = controlServer(1)
var serverY = controlServer(2)

serverX.listen(9001)
serverY.listen(9002)

var output = new midi.output()
console.log(output.getPortName(0))
output.openPort(0)
var midiStream = midi.createWriteStream(output)
mp.getReadableStream().pipe(midiStream)
{'fraction_non_alphanumeric': 0.1340815121086828, 'fraction_numerical': 0.021854695806261076, 'mean_word_length': 6.117647058823529, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7329312', 'n_tokens_mistral': 598, 'n_tokens_neox': 567, 'n_words': 125}