<commit_before>###############################################################
# RandomPlayer class by <NAME>                          #
# refers to the lead sheet and timing to play random notes    #
# check out www.github.com/dan-field/jazz for info and rights #
###############################################################



from music import *
from random import *

class RandomPlayer:
   def __init__(self, ls=None):
      """Initialises a RandomPlayer object"""
      self.phr = Phrase()
      self.thisBeatRhythm = [0.5, 0.5]
      self.thisBeatNotes = [56, 57]
      self.nextBeatRhythm = [0.5, 0.5]
      self.nextBeatNotes = [58, 59]
      
   def playCurrentBeat(self, tempo=None):
      if tempo is None: tempo = 120
      self.phr.setTempo(tempo)
      self.thisBeatRhythm = self.nextBeatRhythm
      self.thisBeatNotes = self.nextBeatNotes
      self.phr.addNoteList(self.thisBeatNotes, self.thisBeatRhythm)
      Play.midi(self.phr)
      self.phr.empty()
   
   def teeUpNextBeat(self):
      a = 0.5 #random()
      b = 1.0 - a
      c = randint(40, 80)
      d = c+randint(-5, 5)
      self.nextBeatRhythm = [a, b]
      self.nextBeatNotes = [c, d]
      

   def beat(self, tempo=None):
      self.playCurrentBeat(tempo)
      self.teeUpNextBeat()<commit_msg>added some randomness to the note velocities<commit_after>###############################################################
# RandomPlayer class by <NAME>                          #
# refers to the lead sheet and timing to play random notes    #
# check out www.github.com/dan-field/jazz for info and rights #
###############################################################



from music import *
from random import *

class RandomPlayer:
   def __init__(self, ls=None):
      """Initialises a RandomPlayer object"""
      self.phr = Phrase()
      self.thisBeatRhythm = [0.5, 0.5]
      self.thisBeatNotes = [56, 57]
      self.thisBeatVelocities = [100, 100]
      self.nextBeatRhythm = [0.5, 0.5]
      self.nextBeatNotes = [58, 59]
      self.nextBeatVelocities = [100, 100]
      
   def playCurrentBeat(self, tempo=None):
      if tempo is None: tempo = 120
      self.phr.setTempo(tempo)
      self.thisBeatRhythm = self.nextBeatRhythm
      self.thisBeatNotes = self.nextBeatNotes
      self.thisBeatVelocities = self.nextBeatVelocities
      self.phr.addNoteList(self.thisBeatNotes, self.thisBeatRhythm, self.thisBeatVelocities)
      Play.midi(self.phr)
      self.phr.empty()
   
   def teeUpNextBeat(self):
      a = 0.5 #random()
      b = 1.0 - a
      c = randint(40, 80)
      d = c+randint(-5, 5)
      e = 100 + randint(-25, 25)
      f = e + randint(-20, 20)
      if f > 127: f=127
      self.nextBeatRhythm = [a, b]
      self.nextBeatNotes = [c, d]
      self.nextBeatVelocities = [e, f]
      

   def beat(self, tempo=None):
      self.playCurrentBeat(tempo)
      self.teeUpNextBeat()
{'fraction_non_alphanumeric': 0.19072343371408793, 'fraction_numerical': 0.030114226375908618, 'mean_word_length': 2.7242268041237114, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '6909979', 'n_tokens_mistral': 1049, 'n_tokens_neox': 923, 'n_words': 219}