Spaces:
Sleeping
Sleeping
Upload folder using huggingface_hub
Browse files- .gitignore +2 -0
- config.yml.example +1 -1
- improvisation_lab/application/interval_practice/web_interval_app.py +0 -2
- improvisation_lab/config.py +1 -1
- improvisation_lab/domain/music_theory.py +1 -1
- improvisation_lab/presentation/interval_practice/web_interval_view.py +2 -2
- tests/presentation/interval_practice/test_web_interval_view.py +1 -1
- tests/test_config.py +1 -1
.gitignore
CHANGED
|
@@ -163,3 +163,5 @@ cython_debug/
|
|
| 163 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 164 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 165 |
#.idea/
|
|
|
|
|
|
|
|
|
| 163 |
# and can be added to the global gitignore or merged into this file. For a more nuclear
|
| 164 |
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
|
| 165 |
#.idea/
|
| 166 |
+
|
| 167 |
+
.codegpt
|
config.yml.example
CHANGED
|
@@ -11,7 +11,7 @@ audio:
|
|
| 11 |
|
| 12 |
interval_practice:
|
| 13 |
num_problems: 10
|
| 14 |
-
interval:
|
| 15 |
|
| 16 |
piece_practice:
|
| 17 |
selected_song: "fly_me_to_the_moon"
|
|
|
|
| 11 |
|
| 12 |
interval_practice:
|
| 13 |
num_problems: 10
|
| 14 |
+
interval: 0
|
| 15 |
|
| 16 |
piece_practice:
|
| 17 |
selected_song: "fly_me_to_the_moon"
|
improvisation_lab/application/interval_practice/web_interval_app.py
CHANGED
|
@@ -193,8 +193,6 @@ class WebIntervalPracticeApp(BasePracticeApp):
|
|
| 193 |
return
|
| 194 |
|
| 195 |
target_note = self.phrases[self.current_phrase_idx][self.current_note_idx].value
|
| 196 |
-
if self.base_note == target_note:
|
| 197 |
-
return
|
| 198 |
detected_note = self.text_manager.result_text.split("|")[1].strip()
|
| 199 |
detected_note = detected_note.replace("Your note: ", "").replace(" ", "")
|
| 200 |
# Result determination
|
|
|
|
| 193 |
return
|
| 194 |
|
| 195 |
target_note = self.phrases[self.current_phrase_idx][self.current_note_idx].value
|
|
|
|
|
|
|
| 196 |
detected_note = self.text_manager.result_text.split("|")[1].strip()
|
| 197 |
detected_note = detected_note.replace("Your note: ", "").replace(" ", "")
|
| 198 |
# Result determination
|
improvisation_lab/config.py
CHANGED
|
@@ -53,7 +53,7 @@ class IntervalPracticeConfig:
|
|
| 53 |
"""Configuration settings for interval practice."""
|
| 54 |
|
| 55 |
num_problems: int = 10
|
| 56 |
-
interval: int =
|
| 57 |
|
| 58 |
@classmethod
|
| 59 |
def from_yaml(cls, yaml_data: dict) -> "IntervalPracticeConfig":
|
|
|
|
| 53 |
"""Configuration settings for interval practice."""
|
| 54 |
|
| 55 |
num_problems: int = 10
|
| 56 |
+
interval: int = 0
|
| 57 |
|
| 58 |
@classmethod
|
| 59 |
def from_yaml(cls, yaml_data: dict) -> "IntervalPracticeConfig":
|
improvisation_lab/domain/music_theory.py
CHANGED
|
@@ -180,6 +180,7 @@ class Intervals:
|
|
| 180 |
"""
|
| 181 |
|
| 182 |
INTERVALS_MAP = {
|
|
|
|
| 183 |
"minor 2nd": 1,
|
| 184 |
"major 2nd": 2,
|
| 185 |
"minor 3rd": 3,
|
|
@@ -191,5 +192,4 @@ class Intervals:
|
|
| 191 |
"major 6th": 9,
|
| 192 |
"minor 7th": 10,
|
| 193 |
"major 7th": 11,
|
| 194 |
-
"perfect 8th": 12,
|
| 195 |
}
|
|
|
|
| 180 |
"""
|
| 181 |
|
| 182 |
INTERVALS_MAP = {
|
| 183 |
+
"perfect 1st": 0,
|
| 184 |
"minor 2nd": 1,
|
| 185 |
"major 2nd": 2,
|
| 186 |
"minor 3rd": 3,
|
|
|
|
| 192 |
"major 6th": 9,
|
| 193 |
"minor 7th": 10,
|
| 194 |
"major 7th": 11,
|
|
|
|
| 195 |
}
|
improvisation_lab/presentation/interval_practice/web_interval_view.py
CHANGED
|
@@ -50,7 +50,7 @@ class WebIntervalPracticeView(WebPracticeView):
|
|
| 50 |
for key, value in Intervals.INTERVALS_MAP.items()
|
| 51 |
if value == absolute_interval
|
| 52 |
),
|
| 53 |
-
"
|
| 54 |
)
|
| 55 |
|
| 56 |
def _build_interface(self) -> gr.Blocks:
|
|
@@ -87,7 +87,7 @@ class WebIntervalPracticeView(WebPracticeView):
|
|
| 87 |
)
|
| 88 |
self.note_duration_box = gr.Number(
|
| 89 |
label="Note Duration (seconds)",
|
| 90 |
-
value=
|
| 91 |
)
|
| 92 |
|
| 93 |
self.generate_melody_button = gr.Button("Generate Melody")
|
|
|
|
| 50 |
for key, value in Intervals.INTERVALS_MAP.items()
|
| 51 |
if value == absolute_interval
|
| 52 |
),
|
| 53 |
+
"perfect 1st", # Default value if no match is found
|
| 54 |
)
|
| 55 |
|
| 56 |
def _build_interface(self) -> gr.Blocks:
|
|
|
|
| 87 |
)
|
| 88 |
self.note_duration_box = gr.Number(
|
| 89 |
label="Note Duration (seconds)",
|
| 90 |
+
value=4.0,
|
| 91 |
)
|
| 92 |
|
| 93 |
self.generate_melody_button = gr.Button("Generate Melody")
|
tests/presentation/interval_practice/test_web_interval_view.py
CHANGED
|
@@ -35,7 +35,7 @@ class TestWebIntervalPracticeView:
|
|
| 35 |
self.web_view._initialize_interval_settings()
|
| 36 |
assert self.web_view.init_num_problems == 10
|
| 37 |
assert self.web_view.initial_direction == "Up"
|
| 38 |
-
assert self.web_view.initial_interval_key == "
|
| 39 |
|
| 40 |
@pytest.mark.usefixtures("init_module")
|
| 41 |
def test_build_interface(self):
|
|
|
|
| 35 |
self.web_view._initialize_interval_settings()
|
| 36 |
assert self.web_view.init_num_problems == 10
|
| 37 |
assert self.web_view.initial_direction == "Up"
|
| 38 |
+
assert self.web_view.initial_interval_key == "perfect 1st"
|
| 39 |
|
| 40 |
@pytest.mark.usefixtures("init_module")
|
| 41 |
def test_build_interface(self):
|
tests/test_config.py
CHANGED
|
@@ -54,7 +54,7 @@ class TestConfig:
|
|
| 54 |
assert config.audio.buffer_duration == 0.3
|
| 55 |
assert config.audio.note_duration == 1.0
|
| 56 |
assert config.interval_practice.num_problems == 10
|
| 57 |
-
assert config.interval_practice.interval ==
|
| 58 |
assert config.piece_practice.selected_song == "fly_me_to_the_moon"
|
| 59 |
assert "fly_me_to_the_moon" in config.piece_practice.chord_progressions
|
| 60 |
|
|
|
|
| 54 |
assert config.audio.buffer_duration == 0.3
|
| 55 |
assert config.audio.note_duration == 1.0
|
| 56 |
assert config.interval_practice.num_problems == 10
|
| 57 |
+
assert config.interval_practice.interval == 0
|
| 58 |
assert config.piece_practice.selected_song == "fly_me_to_the_moon"
|
| 59 |
assert "fly_me_to_the_moon" in config.piece_practice.chord_progressions
|
| 60 |
|