Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change default octave for clefs in heuristic pitch finding #1208

Merged
merged 6 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions rodan-main/code/rodan/jobs/heuristic_pitch_finding/PitchFinding.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from gamera import gamera_xml
from gamera.plugins.image_utilities import union_images
from operator import itemgetter, attrgetter
import logging
logger = logging.getLogger("__name__")
from celery.utils.log import get_task_logger
lucasmarchd01 marked this conversation as resolved.
Show resolved Hide resolved
logger = get_task_logger(__name__)
from math import floor

class PitchFinder(object):
Expand Down Expand Up @@ -497,10 +497,16 @@ def __glyph_type(g):
note = SCALE[int((clef_line - my_strt_pos + noteShift) % len(SCALE))]

# find octave
clef_octave_map = {
'c': 4,
'f': 3,
'g': 5
lucasmarchd01 marked this conversation as resolved.
Show resolved Hide resolved
}
base_octave = clef_octave_map.get(clef, 3)
if my_strt_pos <= clef_line:
octave = 3 + floor((clef_line - my_strt_pos + noteShift) / len(SCALE))
octave = base_octave + floor((clef_line - my_strt_pos + noteShift) / len(SCALE))
elif my_strt_pos > clef_line:
octave = 3 - floor((len(SCALE) - clef_line + my_strt_pos - 1 - noteShift) / len(SCALE))
octave = base_octave - floor((len(SCALE) - clef_line + my_strt_pos - 1 - noteShift) / len(SCALE))

glyph_array.extend([note, octave, clef_line, 'clef.' + clef])

Expand Down
lucasmarchd01 marked this conversation as resolved.
Show resolved Hide resolved

Large diffs are not rendered by default.

Loading