You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, the Pitch class provides octaved_sargam_letter which uses Unicode combining diacritics (e.g., \u0307 for dot above, \u0323 for dot below). However, these Unicode diacritics often render poorly in visualization libraries like matplotlib:
Dots above uppercase letters (Ṡ, Ṙ, Ġ) are barely visible or overlap with the letter
Font-dependent rendering inconsistencies
Horizontal positioning issues in some rendering contexts
Proposed Solution
Add LaTeX math mode properties to the Pitch class for proper diacritic positioning:
latex_sargam_letter - LaTeX-compatible base sargam letter
latex_octaved_sargam_letter - LaTeX math mode with properly positioned diacritics
Implementation Plan
Add new methods to Pitch class:
def_octave_latex_diacritic(self) ->str:
"""Convert octave to LaTeX math notation for proper diacritic positioning."""mapping= {
-3: r'\underset{\bullet\bullet\bullet}', # Triple dot below -2: r'\underset{\bullet\bullet}', # Double dot below-1: r'\underset{\bullet}', # Single dot below1: r'\dot', # Single dot above2: r'\ddot', # Double dot above 3: r'\dddot'# Triple dot above
}
returnmapping.get(self.oct, '')
@propertydeflatex_sargam_letter(self) ->str:
"""LaTeX-compatible base sargam letter."""returnself.sargam_letter@propertydeflatex_octaved_sargam_letter(self) ->str:
"""LaTeX math mode sargam letter with properly positioned diacritics."""base_letter=self.sargam_letterlatex_diacritic=self._octave_latex_diacritic()
ifnotlatex_diacritic:
returnbase_letter# No octave markingeliflatex_diacritic.startswith(r'\underset'):
returnf'${latex_diacritic}{{\\mathrm{{{base_letter}}}}}$'else:
returnf'${latex_diacritic}{{\\mathrm{{{base_letter}}}}}$'
Problem
Currently, the
Pitchclass providesoctaved_sargam_letterwhich uses Unicode combining diacritics (e.g.,\u0307for dot above,\u0323for dot below). However, these Unicode diacritics often render poorly in visualization libraries like matplotlib:Proposed Solution
Add LaTeX math mode properties to the
Pitchclass for proper diacritic positioning:latex_sargam_letter- LaTeX-compatible base sargam letterlatex_octaved_sargam_letter- LaTeX math mode with properly positioned diacriticsImplementation Plan
Add new methods to
Pitchclass:Usage Example:
Benefits
Testing Requirements
This enhancement would significantly improve the usability of IDTAP for creating high-quality musical visualizations.