コード例 #1
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        random_steps = []

        random_degrees = degree.Degree().get_random_degrees(quantity)
        random_scales_1 = mode.Mode().get_random_modes(quantity, with_note=False)
        random_scales_2 = mode.Mode().get_random_modes(quantity, with_note=False)

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

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
コード例 #2
0
ファイル: interval.py プロジェクト: kuzeygh/Python-Library
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        degree_obj = degree.Degree()
        mode_obj = mode.Mode()
        random_steps = []

        for step_index in range(0, quantity):
            mode_text = mode_obj.get_random_mode() + " " + self._get_direction(
            )

            step_text = ""

            while True:
                degree_count = random.randint(2, 4)
                degrees = degree_obj.get_random_degrees(degree_count,
                                                        limit_octave=True)
                if not (
                    (degree_count == 2 and degrees[0] == degrees[1]) or
                    (degree_count == 2 and abs(degrees[1] - degrees[0]) == 1)):
                    break

            for deg in degrees:
                if step_text != "":
                    step_text += ", "
                step_text += str(deg)

            random_step = exercise_step.ExerciseStep(mode_text,
                                                     sub_text=step_text)
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
コード例 #3
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:
        random_steps = []

        random_modes = mode.Mode().get_random_modes(quantity)

        for random_mode in random_modes:
            random_step = exercise_step.ExerciseStep(
                random_mode,
                super(ScaleOfMode, self).get_random_position_suggestion_text())
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
コード例 #4
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
コード例 #5
0
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns random interval exercises """
        if guitar["kind"] != "instrument":
            return None

        degree_obj = degree.Degree()
        mode_obj = mode.Mode()
        random_steps = []

        for step_index in range(0, quantity):  # pylint: disable=W0612
            mode_text = f"{mode_obj.get_random_mode()} {self._get_direction()}"

            step_text = ""

            while True:
                degree_count = 2
                degrees = degree_obj.get_random_degrees(degree_count,
                                                        limit_octave=True)
                if not (
                    (degree_count == 2 and degrees[0] == degrees[1]) or
                    (degree_count == 2 and abs(degrees[1] - degrees[0]) == 1)):
                    break

            for deg in degrees:
                if step_text != "":
                    step_text += ", "
                step_text += str(deg)

            random_step = exercise_step.ExerciseStep(mode_text,
                                                     sub_text=step_text)
            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_modes = mode.Mode().get_random_modes(quantity_left)

        random_stuff = []

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

        try:
            for i in range(len(random_modes)):
                random_stuff.append(random_modes[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._SUBTITLE, random_steps)
        return output