Description:
Hi folks! Strange little exception here: I’m trying to pass on some text to each note (different articulation types) so that I can later on edit the proper dynamics in Musecore. So I’m formatting the text with the proper cent derivation and the attributed articulation (from a dictionary).
I managed to make it work once for a short music bit but then this happens with longer bits :
Any idea ? Thanks !
Error printout:
Exception in thread Thread-203 (_handle_results):
Traceback (most recent call last):
File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1016, in _bootstrap_inner
self.run()
File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 953, in run
self._target(*self._args, **self._kwargs)
File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 595, in _handle_results
cache[job]._set(i, obj)
File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 781, in _set
self._error_callback(self._value)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/clockblocks/clock.py", line 92, in _threadpool_error_callback
raise e
File "/Applications/Thonny.app/Contents/Frameworks/Python.framework/Versions/3.10/lib/python3.10/multiprocessing/pool.py", line 125, in worker
result = (True, func(*args, **kwds))
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/clockblocks/clock.py", line 892, in _process
process_function(*args, **kwds)
File "/Users/Gabriel/Dropbox/Musique/Compo_Instrumentale/Scamp/definitions.py", line 39, in microtonal_player
instrument.play_note(int(pitch + 1), vol, dur, f"{arti}")
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/scamp/instruments.py", line 422, in play_note
properties = NoteProperties.interpret(properties)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/scamp/note_properties.py", line 237, in interpret
return cls(**_parsing.parse_note_properties(properties_object))
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/scamp/_parsing.py", line 294, in parse_note_properties
parse_tree = _properties_parser.parse(note_properties_string)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 1525, in parse
self.parse_tree = self._parse()
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/peg.py", line 279, in _parse
return self.parser_model.parse(self)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 300, in parse
result = self._parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 379, in _parse
result = e.parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 798, in parse
result = self._parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 954, in _parse
parser._nm_raise(self, c_pos, parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 1727, in _nm_raise
raise self.nm
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 494, in _parse
result = p(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 300, in parse
result = self._parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 379, in _parse
result = e.parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 798, in parse
result = self._parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 907, in _parse
parser._nm_raise(self, c_pos, parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 1727, in _nm_raise
raise self.nm
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 494, in _parse
result = p(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 300, in parse
result = self._parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 379, in _parse
result = e.parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 798, in parse
result = self._parse(parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 907, in _parse
parser._nm_raise(self, c_pos, parser)
File "/Users/Gabriel/Library/Python/3.10/lib/python/site-packages/arpeggio/__init__.py", line 1727, in _nm_raise
raise self.nm
arpeggio.NoMatch: Expected '/' or ',' or EOF at position (1, 3) => 'so*ufflet'.
The full code that resulted in the error:
def microtonal_player(instrument, pitch, vol, dur, arti, score_mode=True):
print(pitch)
cents = round(pitch % 1 * 50)
# f_pitch = round(pitch, 2)
if score_mode:
if dur < 0:
wait(abs(dur))
else :
# print(cents)
if cents < 5:
instrument.play_note(int(pitch), vol, dur, f" {arti}")
# print('5c')
elif cents < 23:
instrument.play_note(int(pitch), vol, dur, f"+ {cents} {arti}")
# print('23c')
elif (cents >= 24) and (cents <= 27):
instrument.play_note(int(pitch), vol, dur, f"+ 25 {arti}")
# print('25c')
elif cents < 45:
instrument.play_note(int(pitch + 1), vol, dur, f"{cents - 50} {arti}")
# print('45c')
else:
instrument.play_note(int(pitch + 1), vol, dur, f" {arti}")