<commit_before>THRESHOLD = 200
X_THRESHOLD = THRESHOLD
Y_THRESHOLD = THRESHOLD
Z_THRESHOLD = THRESHOLD

PROXIMITY_PAIRS =
  leftHand: [
    pairPoint: 'rightHand'
    note: 62
  ,
    pairPoint: 'leftShoulder'
    note: 64
  ,
    pairPoint: 'leftHip'
    note: 67
  ]
  rightHand: [
    pairPoint: 'rightShoulder'
    note: 66
  ,
    pairPoint: 'rightHip'
    note: 69
  ]

class @Synth
  constructor: (@audioContext, @noteMap) ->
    @voices = {}

  handleMessage: (message) =>
    if message.noteOn
      @playPad(message.x, message.y, message.identifier)
    else
      @stopPad(message.identifier)

  playPad: (x, y, identifier) ->
    midiNoteNumber = @noteMap.getNote(y)
    @playNote(midiNoteNumber, identifier)

  playNote: (midiNoteNumber, identifier) ->
    voice = @voices[identifier]
    unless voice?
      voice = new Voice @audioContext
      @voices[identifier] = voice
    @playMidiNote(midiNoteNumber, voice)

  playSkeletons: (skeletons) =>
    if skeletons.length > 0
      skeleton = skeletons[0].skeleton
      for pairA, pairs of PROXIMITY_PAIRS
        for pairData in pairs
          id = "#{pairA}#{pairB}"
          pairB = pairData.pairPoint
          pointA = skeleton[pairA]
          pointB = skeleton[pairB]
          if @_pointsInProximity(pointA, pointB)
            @playNote(pairData.note, id)
          else
            @stopPad(id)
    else
      for pairA, pairs of PROXIMITY_PAIRS
        for pairData in pairs
          id = "#{pairA}#{pairB}"
          @stopPad(id)


  _pointsInProximity: (pointA, pointB) ->
    return Math.abs(pointA.x - pointB.x) < X_THRESHOLD \
      and Math.abs(pointA.y - pointB.y) < Y_THRESHOLD \
      and Math.abs(pointA.z - pointB.z) < Z_THRESHOLD
<commit_msg>Points kill<commit_after>THRESHOLD = 200
X_THRESHOLD = THRESHOLD
Y_THRESHOLD = THRESHOLD
Z_THRESHOLD = THRESHOLD

PROXIMITY_PAIRS =
  leftHand: [
    pairPoint: 'rightHand'
    note: 62
  ,
    pairPoint: 'leftShoulder'
    note: 64
  ,
    pairPoint: 'leftHip'
    note: 67
  ]
  rightHand: [
    pairPoint: 'rightShoulder'
    note: 66
  ,
    pairPoint: 'rightHip'
    note: 69
  ]

class @Synth
  constructor: (@audioContext, @noteMap) ->
    @voices = {}

  handleMessage: (message) =>
    if message.noteOn
      @playPad(message.x, message.y, message.identifier)
    else
      @stopPad(message.identifier)

  playPad: (x, y, identifier) ->
    midiNoteNumber = @noteMap.getNote(y)
    @playNote(midiNoteNumber, identifier)

  playNote: (midiNoteNumber, identifier) ->
    voice = @voices[identifier]
    unless voice?
      voice = new Voice @audioContext
      @voices[identifier] = voice
    @playMidiNote(midiNoteNumber, voice)

  playSkeletons: (skeletons) =>
    console.log skeletons
    if skeletons.length > 0
      skeleton = skeletons[0].skeleton
      for pairA, pairs of PROXIMITY_PAIRS
        for pairData in pairs
          pairB = pairData.pairPoint
          pointA = skeleton[pairA]
          pointB = skeleton[pairB]
          id = "#{pairA}#{pairB}"
          if @_pointsInProximity(pointA, pointB)
            @playNote(pairData.note, id)
          else
            @stopPad(id)
    else
      for pairA, pairs of PROXIMITY_PAIRS
        for pairData in pairs
          pairB = pairData.pairPoint
          id = "#{pairA}#{pairB}"
          @stopPad(id)

  _pointsInProximity: (pointA, pointB) ->
    return Math.abs(pointA.x - pointB.x) < X_THRESHOLD \
      and Math.abs(pointA.y - pointB.y) < Y_THRESHOLD \
      and Math.abs(pointA.z - pointB.z) < Z_THRESHOLD

{'fraction_non_alphanumeric': 0.1074872376630743, 'fraction_numerical': 0.008508224617129892, 'mean_word_length': 2.541164658634538, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 17, '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': '1973952', 'n_tokens_mistral': 1311, 'n_tokens_neox': 1254, 'n_words': 261}