<commit_before>Pattern Tools
=============

    require "cornerstone"

    tools = [
      (self, {beat, note}) ->
        # Add Note to Score
        instrument = self.activeInstrument()

        self.addNote [beat, note, instrument]

        self.playNote instrument, note

      (self, {beat, note}) ->
        if self.activePattern().removeNote [beat, note]
          ;# TODO: Play remove sound
    ]

    module.exports = (I, self) ->
      defaults I,
        activeInstrument: 1
        activeToolIndex: 0

      self.attrObservable "activeInstrument", "activeToolIndex"

      self.extend
        activeTool: ->
          tools[self.activeToolIndex()]

      self.activeInstrument.observe (instrument) ->
        self.playNote instrument
        self.setCursor()

      self.activeToolIndex.observe ->
        self.setCursor()

      # Hotkeys
      self.include require "hotkeys"

      self.addHotkey "space", "pause"

      [1..9].forEach (i) ->
        self.addHotkey i.toString(), ->
          self.activeInstrument i - 1
          self.activeToolIndex(0)

      self.addHotkey "0", ->
        self.activeInstrument 9
        self.activeToolIndex(0)

      self.addHotkey "e", ->
        self.activeToolIndex(1)

      return self<commit_msg>:fuelpump::microphone: Updated in browser at strd6.github.io/editor<commit_after>Pattern Tools
=============

    require "cornerstone"

    tools = [
      (self, {beat, note}) ->
        # Add Note to Score
        instrument = self.activeInstrument()

        self.addNote [beat, note, instrument]

        self.playNote instrument, note

      (self, {beat, note}) ->
        if self.activePattern().removeNote [beat, note]
          ;# TODO: Play remove sound
    ]

    module.exports = (I, self) ->
      defaults I,
        activeInstrument: 1
        activeToolIndex: 0

      self.attrObservable "activeInstrument", "activeToolIndex"

      self.extend
        activeTool: ->
          tools[self.activeToolIndex()]

      self.activeInstrument.observe (instrument) ->
        self.setCursor()

      self.activeToolIndex.observe ->
        self.setCursor()

      # Hotkeys
      self.include require "hotkeys"

      self.addHotkey "space", "pause"

      [1..9].forEach (i) ->
        self.addHotkey i.toString(), ->
          self.playNote i - 1
          self.activeInstrument i - 1
          self.activeToolIndex(0)

      self.addHotkey "0", ->
        self.playNote 9
        self.activeInstrument 9
        self.activeToolIndex(0)

      self.addHotkey "e", ->
        self.activeToolIndex(1)

      return self
{'fraction_non_alphanumeric': 0.12030947775628627, 'fraction_numerical': 0.008897485493230174, 'mean_word_length': 2.024561403508772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '3064969', 'n_tokens_mistral': 785, 'n_tokens_neox': 740, 'n_words': 165}