Exemplo n.º 1
0
 async def run(self):
     cbn = self.agent.get("current_bar_no")
     if cbn < CFG.SONG_LENGTH:  # falta sacar con modulo, de momento es un acorde por barra
         msg = await self.receive()
         if msg:
             if self.agent.get("chords_template").match(msg):
                 if chords.determine_triad(
                         getattr(chords, CFG.PROGRESSIONS[cbn])(
                             CFG.SONG_KEY_SIGNATURE),
                         True) == chords.determine_triad(
                             msg.body.split(','), True):
                     cab = self.agent.get("current_accompaniment_bar")
                     cab.place_notes(msg.body.split(','),
                                     1)  # de momento es un acorde por barra
                     at = self.agent.get("accompaniment_track")
                     at.add_bar(cab)
                     self.agent.set(
                         "current_accompaniment_bar",
                         Bar(CFG.SONG_KEY_SIGNATURE,
                             CFG.SONG_TIME_SIGNATURE))
                     self.agent.set("accompaniment_track", at)
                     self.set_next_state(S_RECEIVE_NOTE)
                 else:
                     self.set_next_state(
                         S_RECEIVE_CHORD)  # Continúa en el mismo estado
             else:
                 self.set_next_state(
                     S_RECEIVE_CHORD)  # Continúa en el mismo estado
         else:
             self.set_next_state(
                 S_RECEIVE_CHORD)  # Continúa en el mismo estado
     else:
         self.set_next_state(S_PUBLISH_SONG)
Exemplo n.º 2
0
 def test_determine_triad_shorthand(self):
     self.chordsTest([
         [['Am', 'CM6'], ['A', 'C', 'E']],
         [['CM'], ['C', 'E', 'G']],
         [['Edim', 'Gm6'], ['E', 'G', 'Bb']],
         [['Faug'], ['F', 'A', 'C#']],
         [['Csus4', 'Fsus2'], ['C', 'F', 'G']],
         [['Csus2', 'Gsus4'], ['C', 'D', 'G']],
     ], lambda x: chords.determine_triad(x, True), 'proper naming')
Exemplo n.º 3
0
	def test_determine_triad_shorthand(self):

		self.chordsTest([ [["Am", "CM6"], ["A", "C", "E"]],\
   						  [["CM"], ["C", "E", "G"]],\
						  [["Edim", "Gm6"], ["E", "G", "Bb"]],\
						  [["Faug"], ["F", "A", "C#"]],\
						  [["Csus4", "Fsus2"], ["C", "F", "G"]],\
						  [["Csus2", "Gsus4"], ["C", "D", "G"]]],\
				lambda x: chords.determine_triad(x, True), "proper naming")
Exemplo n.º 4
0
 def test_determine_triad_shorthand(self):
     self.chordsTest([
         [['Am', 'CM6'], ['A', 'C', 'E']],
         [['CM'], ['C', 'E', 'G']],
         [['Edim', 'Gm6'], ['E', 'G', 'Bb']],
         [['Faug'], ['F', 'A', 'C#']],
         [['Csus4', 'Fsus2'], ['C', 'F', 'G']],
         [['Csus2', 'Gsus4'], ['C', 'D', 'G']],
         ], lambda x: chords.determine_triad(x, True), 'proper naming')
Exemplo n.º 5
0
 def test_determine_triad_shorthand(self):
     self.chordsTest(
         [
             [["Am", "CM6"], ["A", "C", "E"]],
             [["CM"], ["C", "E", "G"]],
             [["Edim", "Gm6"], ["E", "G", "Bb"]],
             [["Faug"], ["F", "A", "C#"]],
             [["Csus4", "Fsus2"], ["C", "F", "G"]],
             [["Csus2", "Gsus4"], ["C", "D", "G"]],
         ],
         lambda x: chords.determine_triad(x, True),
         "proper naming",
     )