示例#1
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:
        random_steps = []

        for i in range(quantity):

            # Get chords
            number_of_chords = random.randint(1, 3)
            chords = chord.Chord().get_random_chords(number_of_chords)

            # Build chord text
            chord_txt = ""
            sub_txt = ""
            for ch in chords:
                if chord_txt == "":
                    chord_txt = ch
                else:
                    if sub_txt == "":
                        sub_txt = "followed by: "
                    else:
                        sub_txt += " | "
                    sub_txt += ch

            # Add to steps
            random_step = exercise_step.ExerciseStep(chord_txt, sub_txt)
            random_steps.append(random_step)

        output = exercise.Exercise(self._get_random_approach(), self._SUBTITLE,
                                   random_steps)
        return output
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns random chord connection exercises """
        if guitar["kind"] != "instrument":
            return None

        random_steps = []
        random_improvs = improv.Improv().get_improvs(quantity)

        for random_improv in random_improvs:
            context_count = random.randint(2, 4)
            stuff = chord.Chord().get_random_chords(context_count)

            stuff_txt = ""
            for stuff_char in stuff:
                if stuff_txt != "":
                    stuff_txt += " | "
                stuff_txt += stuff_char

            random_step = exercise_step.ExerciseStep(random_improv, stuff_txt)
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   self._SUBTITLE,
                                   random_steps,
                                   practice_category=self.category)
        return output
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns random chord exercises """
        if guitar["kind"] != "instrument":
            return None

        random_steps = []

        for chord_pos in range(0, quantity):  # pylint: disable=W0612
            context_count = random.randint(2, 4)
            stuff = chord.Chord().get_random_chords(context_count)

            stuff_txt = ""
            for stuff_char in stuff:
                if stuff_txt != "":
                    stuff_txt += " | "
                stuff_txt += stuff_char

            random_step = exercise_step.ExerciseStep(
                Chords._get_random_position(), stuff_txt)

            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   self._SUBTITLE,
                                   random_steps,
                                   practice_category=self.category)

        return output
示例#4
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        random_steps = []

        random_chords = chord.Chord().get_random_chords(quantity)

        for random_chord in random_chords:
            random_step = exercise_step.ExerciseStep(random_chord, super(ScaleOnChord, self).get_random_position_suggestion_text())
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
示例#5
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        random_steps = []

        random_chords = chord.Chord().get_random_chords(quantity)
        random_degrees = degree.Degree().get_random_degrees(quantity)

        for i in range(quantity):
            random_step = exercise_step.ExerciseStep(
                random_chords[i] + " deg " + str(random_degrees[i]),
                "follow by playing on fretboard")
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
示例#6
0
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns harmonic over random chord connection exercises """
        if guitar["strings"] <= 0:
            return None

        random_steps = []
        random_chords = chord.Chord().get_random_chords(quantity)

        for random_chord in random_chords:
            random_step = exercise_step.ExerciseStep(random_chord, "")
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   self._SUBTITLE,
                                   random_steps,
                                   practice_category=self.category)
        return output
示例#7
0
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns arpeggio exercise """
        if guitar["kind"] != "instrument":
            return None

        # ---Preparation-----

        random_steps = []
        random_scales = []

        # ---Build random list-----

        random_chords = chord.Chord().get_random_chords(quantity)
        quantity_left = quantity - len(random_chords)
        if quantity_left > 0:
            random_scales = scale.Scale().get_random_scales(quantity_left)

        random_stuff = []

        for i in range(len(random_chords)):
            random_stuff.append(random_chords[i])

        try:
            for i in range(len(random_scales)):
                random_stuff.append(random_scales[i])
        except Exception:
            pass

        # ---Build return list-----

        for random_arp in random_stuff:
            suggested_position = Position.get_random_chord_position()

            random_step = exercise_step.ExerciseStep(
                random_arp, f"Suggested position: {str(suggested_position)}")

            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   self._get_arpeggio_type(),
                                   random_steps,
                                   practice_category=self.category)

        return output
示例#8
0
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns degree memo exercises """
        random_steps = []
        random_chords = chord.Chord().get_random_chords(quantity)
        random_degrees = degree.Degree().get_random_degrees(
            quantity, exclude_unison=True)

        for quantity_pos in range(quantity):
            random_step = exercise_step.ExerciseStep(
                f"{random_chords[quantity_pos]} deg {str(random_degrees[quantity_pos])}",
                "follow by playing")
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   self._SUBTITLE,
                                   random_steps,
                                   practice_category=self.category)

        return output
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns random scale on chord exercises """
        if guitar["kind"] != "instrument":
            return None
        random_steps = []
        random_chords = chord.Chord().get_random_chords(quantity)

        for random_chord in random_chords:
            random_step = exercise_step.ExerciseStep(
                random_chord,
                AbstractPractice.get_random_position_suggestion_text()
            )

            random_steps.append(random_step)

        output = exercise.Exercise(
            self._TITLE,
            ScaleOnChord._get_subtitle(),
            random_steps,
            practice_category=self.category)
        return output
示例#10
0
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns anchor note exercise """
        if guitar["kind"] != "instrument":
            return None

        random_steps = []
        i = random.randint(0, 1)

        if i == 0:
            random_steps.append(exercise_step.ExerciseStep("random song"))
        else:
            for random_note in note.Note().get_random_notes(quantity):
                context_count = random.randint(1, 5)

                context_type = random.randint(0, 2)
                if context_type == 0:
                    stuff = chord.Chord().get_random_chords(context_count)
                elif context_type == 1:
                    stuff = mode.Mode().get_random_modes(context_count)
                else:
                    stuff = scale.Scale().get_random_scales(context_count)

                stuff_txt = ""
                for stuff_char in stuff:
                    if stuff_txt != "":
                        stuff_txt += " | "
                    stuff_txt += stuff_char

                random_step = exercise_step.ExerciseStep(
                    random_note, stuff_txt)
                random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   self._SUBTITLE,
                                   random_steps,
                                   practice_category=self.category)

        return output
示例#11
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        # ---Preparation-----

        random_steps = []
        position_obj = position.Position()

        # ---Build random list-----

        random_chords = chord.Chord().get_random_chords(quantity)
        quantity_left = quantity - len(random_chords)
        if quantity_left > 0:
            random_scales = scale.Scale().get_random_scales(quantity_left)

        random_stuff = []

        for i in range(len(random_chords)):
            random_stuff.append(random_chords[i])

        try:
            for i in range(len(random_scales)):
                random_stuff.append(random_scales[i])
        except:
            pass

        # ---Build return list-----

        for random_arp in random_stuff:
            suggested_position = position_obj.get_random_position()

            random_step = exercise_step.ExerciseStep(
                random_arp, "Suggested position: " + str(suggested_position))
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._get_arpeggio_type(),
                                   random_steps)
        return output