Exemplo n.º 1
0
    def get_exercise(self, quantity: int, guitar: dict) -> exercise.Exercise:
        """ Returns exercise """
        if guitar["kind"] != "instrument":
            return None
        if guitar["strings"] <= 0:
            subtitle = "Find the given notes on subsequent octaves"
            strings = guitar["octaves"]
        else:
            subtitle = "Find the given notes on subsequent strings"
            strings = guitar["strings"]

        note_obj = note.Note()
        random_steps = []

        for step_index in range(0, quantity):  # pylint: disable=W0612
            step_text = ""

            note_count = strings
            if self.min_note_count is not None and self.min_note_count > strings:
                note_count = self.min_note_count
            notes_of_step = note_obj.get_random_notes(note_count)
            for note_of_step in notes_of_step:
                if step_text != "":
                    step_text += ", "
                step_text += note_of_step

            random_step = exercise_step.ExerciseStep(step_text)
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE,
                                   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
        if guitar["strings"] <= 0:
            subtitle = "Find the given note(s) on each octave"
        else:
            subtitle = "Find the given note(s) on each string"

        note_obj = note.Note()
        random_steps = []

        for step_index in range(0, quantity):  # pylint: disable=W0612
            step_text = ""

            note_count_of_step = random.randint(1, self._MAX_NOTE_PER_STEP)
            notes_of_step = note_obj.get_random_notes(note_count_of_step)
            for note_of_step in notes_of_step:
                if step_text != "":
                    step_text += ", "
                step_text += note_of_step

            random_step = exercise_step.ExerciseStep(step_text)
            random_steps.append(random_step)

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

        return output
Exemplo n.º 3
0
    def get_exercise(self, quantity: int) -> exercise.Exercise:

        note_obj = note.Note()
        random_steps = []

        for step_index in range(0, quantity):
            step_text = ""

            notes_of_step = note_obj.get_random_notes(self._STRINGS)
            for note_of_step in notes_of_step:
                if step_text != "":
                    step_text += ", "
                step_text += note_of_step

            random_step = exercise_step.ExerciseStep(step_text)
            random_steps.append(random_step)

        output = exercise.Exercise(self._TITLE, self._SUBTITLE, random_steps)
        return output
Exemplo n.º 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