def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns scale degree sequence exercise """
        if guitar["kind"] != "instrument":
            return None
        random_steps = []

        for quantity_pos in range(quantity):  # pylint: disable=W0612
            random_count = random.randint(2, 7)  # pylint: disable=W0612
            random_degrees = degree.Degree().get_random_degrees(7)
            sequence_txt = ""
            for random_pos in range(random_count):  # pylint: disable=W0612
                if sequence_txt != "":
                    sequence_txt += ", "
                sequence_txt += str(random_degrees.pop(0))

            random_scale = scale.Scale().get_random_scale()

            random_step = exercise_step.ExerciseStep(random_scale,
                                                     sequence_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 exercise """
        if guitar["kind"] != "instrument":
            return None
        random_steps = []
        random_scales = scale.Scale().get_random_scales(quantity)

        for random_scale in random_scales:

            # Build random secondary text
            if random.randint(0, 1) == 0:
                secondary_text = AbstractPractice.get_random_position_suggestion_text(
                )  # pylint: disable=C0301
            else:
                secondary_text = "Play at least 2 octaves"

            # Add step
            random_step = exercise_step.ExerciseStep(random_scale,
                                                     secondary_text)
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   ScaleDexterity._get_scale_exercise(guitar),
                                   random_steps,
                                   practice_category=self.category)
        return output
예제 #3
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
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        random_steps = []

        for i in range(quantity):
            random_count = random.randint(2, 7)
            random_degrees = degree.Degree().get_random_degrees(7)
            sequence_txt = ""
            for n in range(random_count):
                if sequence_txt != "":
                    sequence_txt += ", "
                sequence_txt += str(random_degrees.pop(0))

            random_scale = scale.Scale().get_random_scale()

            random_step = exercise_step.ExerciseStep(random_scale,
                                                     sequence_txt)
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
예제 #5
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
예제 #6
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