Raise self.nm arpeggio.NoMatch: Expected '/' or ',' or EOF

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}")

Ah, this is an error with the parser for the note properties argument. Something that you’re sending it is confusing it; might be a bug in SCAMP. Can you track down the exact string you’re using for the note properties argument that causes the issue? Might help me track down a bug.

If you’re trying to get text annotations, it’s more foolproof to use a StaffText object directly, e.g.:

inst.play_note(60, 1, 1, StaffText("senza vib."))

And for annotating pitches, you can also turn on microtonal annotations, which may do what you want automatically:

engraving_settigns.show_microtonal_annotations = True

Thanks Mark!
I’ll try reformatting the text with StaffText. It originates from the line “instrument.play_note(int(pitch), vol, dur, f” {arti}")’. I did change the order of my dictionary and it seemed to have changed to the last elif line.

About microtonal annotations, I’m dealing with some specific demands from an ensemble that plays with tuners. They just want the derivation from the pitch, in cents so they can tune each note with the machine. They find it simpler this way.

Thanks again!

Update : works like a charm with StaffText !

Have a great day.

Did you try engraving_settigns.show_microtonal_annotations = True? It’s not exactly that, but it adds a text annotation that shows the floating point pitch, so it’s pretty close to that.

Regardless, glad it works!

Yes, did try it. It’s working great, they just want that other specific notation. Their score, their rules :wink: