X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=scripts%2Fmidi2ly.py;h=9c490a5f2caf95bd737fee5046878054f69ab364;hb=1c15e46208343b4e40bc4e7bf7ef8d707f752b20;hp=d1fd1ab916e11b762bdfea5fcdfd4e799054f0d2;hpb=35e84fd78a532d59f7254390f066a4f6d424708c;p=lilypond.git diff --git a/scripts/midi2ly.py b/scripts/midi2ly.py index d1fd1ab916..9c490a5f2c 100644 --- a/scripts/midi2ly.py +++ b/scripts/midi2ly.py @@ -386,10 +386,17 @@ class Text: 'PROGRAM_NAME', 'DEVICE_NAME', ) + @staticmethod + def _text_only(chr): + if ((' ' <= chr <= '~') or chr in ['\n','\r']): + return chr + else: + return '~' + def __init__ (self, type, text): self.clocks = 0 self.type = type - self.text = text + self.text =''.join(map(self._text_only, text)) def dump (self): # urg, we should be sure that we're in a lyrics staff