Skip to content

Commit 7b2b2c5

Browse files
committed
added support for N chords
1 parent 7fa0e72 commit 7b2b2c5

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ The main functionality of the Harte Library is an extension of the *Chord Module
5656
This is possible by means of the class __Harte__, which accepts as input a chord expressed in Harte Notation and allows all properties and methods of the Chord module of music21 to be used:
5757

5858
```python
59-
from harte.harte_core import Harte
59+
from harte.harte import Harte
6060

6161
chord = Harte('C#:maj7(b6)/b3')
6262

@@ -75,7 +75,7 @@ In addition, the library implements new methods specific to Harte notation, incl
7575
* __prettify__: breaks the chord into its components and recomposes it by choosing the most summarised shorthand, if possible.
7676

7777
```python
78-
from harte.harte_core import Harte
78+
from harte.harte import Harte
7979

8080
chord = Harte('D:(b3,5,7,9)')
8181

harte/harte_core.py renamed to harte/harte.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,13 @@ def __init__(self, chord: str, **keywords):
3838
f'The input chord {chord} is not a valid Harte chord') \
3939
from name_error
4040

41-
if "root" in parsed_chord:
41+
if self.chord == 'N':
42+
self._root = self._bass = self._degrees = self._shorthand = None
43+
self._all_degrees = []
44+
super().__init__(self._all_degrees)
45+
return
46+
47+
elif "root" in parsed_chord:
4248
# chord is not empty
4349
# retrieve information from the parsed chord
4450
self._root = parsed_chord['root']
@@ -270,6 +276,7 @@ def __str__(self):
270276
# test utilities
271277
test_chord = Harte('N')
272278
root = test_chord.get_root()
279+
print(test_chord.pitchNames)
273280
print(test_chord.fullName)
274281
print(test_chord.commonName)
275282
print(test_chord.inversion())

test/test_harte.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
import pytest
1010

11-
from harte.harte_core import Harte
11+
from harte.harte import Harte
1212

1313
# load a dict of chords frequencies extracted from ChoCo [1]
1414
# to test coverage of a big set of chords
@@ -37,7 +37,8 @@ def test_coverage(chord: str):
3737
("C:maj", ["P5", "M3"]),
3838
("C:min", ["P5", "m3"]),
3939
("C:dim", ["d5", "m3"]),
40-
("C:aug", ["A5", "M3"]), ])
40+
("C:aug", ["A5", "M3"]),
41+
("N", [])])
4142
def test_interval_extraction(chord: str, intervals: List[str]):
4243
"""
4344
Test that the annotateIntervals of music21 correctly works in extracting

0 commit comments

Comments
 (0)