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

Harte('C#:min(b7)/b1') contains C## instead of C #29

Closed
rubencart opened this issue Apr 8, 2024 · 4 comments
Closed

Harte('C#:min(b7)/b1') contains C## instead of C #29

rubencart opened this issue Apr 8, 2024 · 4 comments
Assignees
Labels
bug Something isn't working

Comments

@rubencart
Copy link

c2 = Harte('C#:min(b7)/b1')
c2.pitches
Out[6]: 
(<music21.pitch.Pitch C##3>,
 <music21.pitch.Pitch C#4>,
 <music21.pitch.Pitch E4>,
 <music21.pitch.Pitch G#4>,
 <music21.pitch.Pitch B4>)
c2.prettify()
Out[7]: 'C#:min7(b1)/b1'
c2.unwrap_shorthand()
Out[8]: ['b1', 'b3', '5', 'b7']

I might be wrong, and I don't know this chord, but I don't see where the C##3 comes from? Shouldn't the /b1 in the bass become C4 as first pitch? The chord occurs in biab-internet-corpus_1004.jams in the ChoCo dataset.

@rubencart
Copy link
Author

Think this error might be related. In biab-internet-corpus_1015.jams. bb1 is supposed to mean two semitones down from the root, but the library seems to interpret 1 as an interval of 1 (semitones?) up from the root?

Harte('D#:(3,5,b7)/bb1')

Traceback (most recent call last):
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/IPython/core/interactiveshell.py", line 3553, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-1-3f6292ada5aa>", line 1, in <module>
    Harte('D#:(3,5,b7)/bb1')
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/harte/harte.py", line 95, in __init__
    HarteInterval(x, octave=4).transposeNote(m21_root)
    ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/harte/interval.py", line 34, in __init__
    super().__init__(self._converted_interval, **keywords)
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/music21/interval.py", line 3054, in __init__
    diatonicNew, chromaticNew, inferred = _stringToDiatonicChromatic(name)
                                          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/music21/interval.py", line 2597, in _stringToDiatonicChromatic
    gInterval = GenericInterval(genericNumber)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/music21/interval.py", line 892, in __init__
    self.value = convertGeneric(value)
    ^^^^^^^^^^
  File "/cw/liir_code/NoCsBack/rubenc/miniconda3/envs/harmonyenv/lib/python3.12/site-packages/music21/interval.py", line 945, in value
    raise IntervalException('The Zeroth is not an interval')
music21.interval.IntervalException: The Zeroth is not an interval

@andreamust andreamust self-assigned this Apr 24, 2024
@andreamust andreamust added the bug Something isn't working label Apr 24, 2024
@andreamust
Copy link
Owner

This unexpected behaviour was caused by a bug in the convert_interval function, that was solved in 858d283.
Furthermore, for preventing this type of bugs in the future, pytests for intervals were implemented in 33ec159.

Finally, the latter error was fixed in d3f771b.

All these fixes will be pushed in the next release of the library (0.4.5).

@andreamust
Copy link
Owner

@rubencart
Copy link
Author

Nice thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants