Spaces:
Sleeping
Sleeping
Update utils/chords.py
Browse files- utils/chords.py +9 -9
utils/chords.py
CHANGED
|
@@ -34,17 +34,17 @@ import pandas as pd
|
|
| 34 |
import mir_eval
|
| 35 |
|
| 36 |
|
| 37 |
-
CHORD_DTYPE = [('root', np.
|
| 38 |
-
('bass', np.
|
| 39 |
-
('intervals', np.
|
| 40 |
('is_major',np.bool)]
|
| 41 |
|
| 42 |
-
CHORD_ANN_DTYPE = [('start', np.
|
| 43 |
-
('end', np.
|
| 44 |
('chord', CHORD_DTYPE)]
|
| 45 |
|
| 46 |
-
NO_CHORD = (-1, -1, np.zeros(12, dtype=np.
|
| 47 |
-
UNKNOWN_CHORD = (-1, -1, np.ones(12, dtype=np.
|
| 48 |
|
| 49 |
PITCH_CLASS = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
|
| 50 |
|
|
@@ -287,7 +287,7 @@ class Chords:
|
|
| 287 |
|
| 288 |
"""
|
| 289 |
if given_pitch_classes is None:
|
| 290 |
-
given_pitch_classes = np.zeros(12, dtype=np.
|
| 291 |
for int_def in intervals_str[1:-1].split(','):
|
| 292 |
int_def = int_def.strip()
|
| 293 |
if int_def[0] == '*':
|
|
@@ -320,7 +320,7 @@ class Chords:
|
|
| 320 |
if list_idx != 0:
|
| 321 |
ivs = self._shorthands[quality_str[:list_idx]].copy()
|
| 322 |
else:
|
| 323 |
-
ivs = np.zeros(12, dtype=np.
|
| 324 |
|
| 325 |
|
| 326 |
return self.interval_list(quality_str[list_idx:], ivs)
|
|
|
|
| 34 |
import mir_eval
|
| 35 |
|
| 36 |
|
| 37 |
+
CHORD_DTYPE = [('root', np.int64),
|
| 38 |
+
('bass', np.int64),
|
| 39 |
+
('intervals', np.int64, (12,)),
|
| 40 |
('is_major',np.bool)]
|
| 41 |
|
| 42 |
+
CHORD_ANN_DTYPE = [('start', np.float64),
|
| 43 |
+
('end', np.float64),
|
| 44 |
('chord', CHORD_DTYPE)]
|
| 45 |
|
| 46 |
+
NO_CHORD = (-1, -1, np.zeros(12, dtype=np.int64), False)
|
| 47 |
+
UNKNOWN_CHORD = (-1, -1, np.ones(12, dtype=np.int64) * -1, False)
|
| 48 |
|
| 49 |
PITCH_CLASS = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B']
|
| 50 |
|
|
|
|
| 287 |
|
| 288 |
"""
|
| 289 |
if given_pitch_classes is None:
|
| 290 |
+
given_pitch_classes = np.zeros(12, dtype=np.int64)
|
| 291 |
for int_def in intervals_str[1:-1].split(','):
|
| 292 |
int_def = int_def.strip()
|
| 293 |
if int_def[0] == '*':
|
|
|
|
| 320 |
if list_idx != 0:
|
| 321 |
ivs = self._shorthands[quality_str[:list_idx]].copy()
|
| 322 |
else:
|
| 323 |
+
ivs = np.zeros(12, dtype=np.int64)
|
| 324 |
|
| 325 |
|
| 326 |
return self.interval_list(quality_str[list_idx:], ivs)
|