Skip to content

Commit e4eee83

Browse files
authored
Merge pull request #1864 from cuthbertLab/instrument-abbrev
Fill instrument abbreviations
2 parents 10d4948 + f35f7d8 commit e4eee83

4 files changed

Lines changed: 30 additions & 32 deletions

File tree

.github/workflows/maincheck.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ jobs:
5050
uses: actions/setup-python@v4
5151
with:
5252
python-version: '3.14'
53-
cache: 'pip'
5453
- name: Install uv
5554
uses: astral-sh/setup-uv@v7
5655
with:
@@ -76,7 +75,6 @@ jobs:
7675
uses: actions/setup-python@v4
7776
with:
7877
python-version: '3.14'
79-
cache: 'pip'
8078
- name: Install uv
8179
uses: astral-sh/setup-uv@v7
8280
with:
@@ -99,7 +97,6 @@ jobs:
9997
uses: actions/setup-python@v4
10098
with:
10199
python-version: '3.14'
102-
cache: 'pip'
103100
- name: Install uv
104101
uses: astral-sh/setup-uv@v7
105102
with:

music21/instrument.py

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ def __init__(self, **keywords):
456456
super().__init__(**keywords)
457457

458458
self.instrumentName = 'Reed Organ'
459-
# TODO self.instrumentAbbreviation = ''
459+
self.instrumentAbbreviation = 'R Org'
460460
self.midiProgram = 20
461461
self.instrumentSound = 'keyboard.organ.reed'
462462

@@ -681,7 +681,7 @@ def __init__(self, **keywords):
681681
super().__init__(**keywords)
682682

683683
self.instrumentName = 'Fretless Bass'
684-
# TODO: self.instrumentAbbreviation = ''
684+
self.instrumentAbbreviation = 'Fretl b'
685685
self.midiProgram = 35
686686
self.instrumentSound = 'pluck.bass.fretless'
687687

@@ -752,7 +752,7 @@ def __init__(self, **keywords):
752752
super().__init__(**keywords)
753753

754754
self.instrumentName = 'Shamisen'
755-
# TODO: self.instrumentAbbreviation = ''
755+
self.instrumentAbbreviation = 'Shmsn'
756756
self.instrumentSound = 'pluck.shamisen'
757757
self.midiProgram = 106
758758

@@ -762,7 +762,7 @@ def __init__(self, **keywords):
762762
super().__init__(**keywords)
763763

764764
self.instrumentName = 'Koto'
765-
# TODO: self.instrumentAbbreviation = ''
765+
self.instrumentAbbreviation = 'Koto'
766766
self.instrumentSound = 'pluck.koto'
767767
self.midiProgram = 107
768768

@@ -1248,7 +1248,7 @@ def __init__(self, **keywords):
12481248
super().__init__(**keywords)
12491249

12501250
self.instrumentName = 'Handbells'
1251-
# TODO: self.instrumentAbbreviation = ''
1251+
self.instrumentAbbreviation = 'Hbells'
12521252
self.instrumentSound = 'pitched-percussion.handbells'
12531253

12541254

@@ -1257,7 +1257,7 @@ def __init__(self, **keywords):
12571257
super().__init__(**keywords)
12581258

12591259
self.instrumentName = 'Dulcimer'
1260-
# TODO: self.instrumentAbbreviation = ''
1260+
self.instrumentAbbreviation = 'Dlc'
12611261
self.instrumentSound = 'pluck.dulcimer'
12621262
self.midiProgram = 15
12631263

@@ -1333,7 +1333,7 @@ def __init__(self, **keywords):
13331333
self.instrumentName = 'Maracas'
13341334
self.inGMPercMap = True
13351335
self.percMapPitch = 70
1336-
# TODO: self.instrumentAbbreviation = ''
1336+
self.instrumentAbbreviation = 'Mrcs'
13371337
self.instrumentSound = 'rattle.maraca'
13381338

13391339

@@ -1391,7 +1391,7 @@ def __init__(self, **keywords):
13911391
super().__init__(**keywords)
13921392

13931393
self.instrumentName = 'Suspended Cymbal'
1394-
# TODO: self.instrumentAbbreviation = ''
1394+
self.instrumentAbbreviation = 'Sus Cym'
13951395
self.instrumentSound = 'metal.cymbal.suspended'
13961396

13971397

@@ -1400,7 +1400,7 @@ def __init__(self, **keywords):
14001400
super().__init__(**keywords)
14011401

14021402
self.instrumentName = 'Sizzle Cymbal'
1403-
# TODO: self.instrumentAbbreviation = ''
1403+
self.instrumentAbbreviation = 'Siz Cym'
14041404
self.instrumentSound = 'metal.cymbal.sizzle'
14051405

14061406

@@ -1409,7 +1409,7 @@ def __init__(self, **keywords):
14091409
super().__init__(**keywords)
14101410

14111411
self.instrumentName = 'Splash Cymbals'
1412-
# TODO: self.instrumentAbbreviation = ''
1412+
self.instrumentAbbreviation = 'Spl Cym'
14131413
self.instrumentSound = 'metal.cymbal.splash'
14141414

14151415

@@ -1418,7 +1418,7 @@ def __init__(self, **keywords):
14181418
super().__init__(**keywords)
14191419

14201420
self.instrumentName = 'Ride Cymbals'
1421-
# TODO: self.instrumentAbbreviation = ''
1421+
self.instrumentAbbreviation = 'Ride Cym'
14221422
self.instrumentSound = 'metal.cymbal.ride'
14231423

14241424

@@ -1442,7 +1442,7 @@ def __init__(self, **keywords):
14421442
}
14431443
self.percMapPitch = self._modifierToPercMapPitch[self._modifier]
14441444

1445-
# TODO: self.instrumentAbbreviation = ''
1445+
self.instrumentAbbreviation = 'Hi-Hat'
14461446

14471447

14481448
class Triangle(UnpitchedPercussion):
@@ -1480,7 +1480,7 @@ def __init__(self, **keywords):
14801480
super().__init__(**keywords)
14811481

14821482
self.instrumentName = 'Agogo'
1483-
# TODO: self.instrumentAbbreviation = ''
1483+
self.instrumentAbbreviation = 'Ago'
14841484
self.instrumentSound = 'metal.bells.agogo'
14851485
self.inGMPercMap = True
14861486
self.percMapPitch = 67
@@ -1492,7 +1492,7 @@ def __init__(self, **keywords):
14921492
super().__init__(**keywords)
14931493

14941494
self.instrumentName = 'Tam-Tam'
1495-
# TODO: self.instrumentAbbreviation = ''
1495+
self.instrumentAbbreviation = 'Tam-t'
14961496
self.instrumentSound = 'metal.tamtam'
14971497

14981498

@@ -1501,7 +1501,7 @@ def __init__(self, **keywords):
15011501
super().__init__(**keywords)
15021502

15031503
self.instrumentName = 'Sleigh Bells'
1504-
# TODO: self.instrumentAbbreviation = ''
1504+
self.instrumentAbbreviation = 'Slgh Bl'
15051505
self.instrumentSound = 'metal.bells.sleigh-bells'
15061506

15071507

@@ -1554,7 +1554,7 @@ def __init__(self, **keywords):
15541554
super().__init__(**keywords)
15551555

15561556
self.instrumentName = 'Tom-Tom'
1557-
# TODO: self.instrumentAbbreviation = ''
1557+
self.instrumentAbbreviation = 'Tom'
15581558
self.instrumentSound = 'drum.tom-tom'
15591559
self.inGMPercMap = True
15601560
self._modifier = 'low floor'
@@ -1612,7 +1612,7 @@ def __init__(self, **keywords):
16121612
super().__init__(**keywords)
16131613

16141614
self.instrumentName = 'Taiko'
1615-
# TODO: self.instrumentAbbreviation = ''
1615+
self.instrumentAbbreviation = 'Tko'
16161616
self.instrumentSound = 'drum.taiko'
16171617
self.midiProgram = 116
16181618

@@ -1633,7 +1633,7 @@ def __init__(self, **keywords):
16331633
super().__init__(**keywords)
16341634

16351635
self.instrumentName = 'Whip'
1636-
# TODO: self.instrumentAbbreviation = ''
1636+
self.instrumentAbbreviation = 'Whip'
16371637
self.instrumentSound = 'effect.whip'
16381638

16391639

@@ -1642,7 +1642,7 @@ def __init__(self, **keywords):
16421642
super().__init__(**keywords)
16431643

16441644
self.instrumentName = 'Ratchet'
1645-
# TODO: self.instrumentAbbreviation = ''
1645+
self.instrumentAbbreviation = 'Ratc'
16461646
self.instrumentSound = 'rattle.ratchet'
16471647

16481648

@@ -1651,7 +1651,7 @@ def __init__(self, **keywords):
16511651
super().__init__(**keywords)
16521652

16531653
self.instrumentName = 'Siren'
1654-
# TODO: self.instrumentAbbreviation = ''
1654+
self.instrumentAbbreviation = 'Siren'
16551655
self.instrumentSound = 'effect.siren'
16561656

16571657

@@ -1669,7 +1669,7 @@ def __init__(self, **keywords):
16691669
super().__init__(**keywords)
16701670

16711671
self.instrumentName = 'Wind Machine'
1672-
# TODO: self.instrumentAbbreviation = ''
1672+
self.instrumentAbbreviation = 'Wind Mach'
16731673
self.instrumentSound = 'effect.wind'
16741674

16751675

@@ -2009,7 +2009,7 @@ def deduplicate(s: stream.Stream, inPlace: bool = False) -> stream.Stream:
20092009
73: Flute,
20102010
74: Recorder,
20112011
75: PanFlute,
2012-
76: PanFlute, # TODO 76: Bottle
2012+
76: PanFlute, # TODO: 76: Bottle
20132013
77: Shakuhachi,
20142014
78: Whistle,
20152015
79: Ocarina,
@@ -2045,7 +2045,7 @@ def deduplicate(s: stream.Stream, inPlace: bool = False) -> stream.Stream:
20452045
109: Bagpipes,
20462046
110: Violin, # TODO: instrumentSound
20472047
111: Shehnai,
2048-
112: Glockenspiel, # TODO 112: Tinkle Bell
2048+
112: Glockenspiel, # TODO: 112: Tinkle Bell
20492049
113: Agogo,
20502050
114: SteelDrum,
20512051
115: Woodblock,
@@ -2060,7 +2060,7 @@ def deduplicate(s: stream.Stream, inPlace: bool = False) -> stream.Stream:
20602060
124: Sampler,
20612061
125: Sampler,
20622062
126: Sampler,
2063-
127: Sampler
2063+
127: Sampler,
20642064
}
20652065

20662066

music21/test/commonTest.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,8 @@ def _getName(self, fp):
348348
if fn.startswith(os.sep):
349349
fn = fn[1:]
350350
fn = fn.replace(os.sep, '_') # replace w/ _
351-
fn = fn.replace('.py', '')
351+
if fn.endswith('.py'):
352+
fn = fn[:-3]
352353
return fn
353354

354355
def _getNamePeriod(self, fp, *, addM21=False):
@@ -363,11 +364,11 @@ def _getNamePeriod(self, fp, *, addM21=False):
363364
'''
364365
fn = fp.replace(self.dirParent, '') # remove parent
365366
parts = [x for x in fn.split(os.sep) if x]
366-
if parts[-1] == '__init__.py':
367+
if parts[-1].endswith('.py'):
368+
parts[-1] = parts[-1][:-3]
369+
if parts[-1] == '__init__':
367370
parts.pop()
368371
fn = '.'.join(parts) # replace w/ period
369-
370-
fn = fn.replace('.py', '')
371372
if addM21 and fn:
372373
fn = 'music21.' + fn
373374
elif addM21:

music21/test/multiprocessTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ def mainPoolRunner(testGroup=('test',), restoreEnvironmentDefaults=False, leaveO
165165
eventsProcessed = 0
166166
summaryOutput = []
167167

168-
while continueIt is True:
168+
while continueIt:
169169
try:
170170
newResult = res.next(timeout=1)
171171
if timeouts >= 5:

0 commit comments

Comments
 (0)