def parseFile(self, fp, number=None): ''' Open Noteworthy data (as nwctxt) from a file path. >>> import os #_DOCS_HIDE >>> nwcTranslatePath = common.getSourceFilePath() + os.path.sep + 'noteworthy' #_DOCS_HIDE >>> filePath = nwcTranslatePath + os.path.sep + 'Part_OWeisheit.nwctxt' #_DOCS_HIDE >>> #_DOCS_SHOW paertPath = converter.parse('d:/desktop/arvo_part_o_weisheit.nwctxt') >>> c = converter.subConverters.ConverterNoteworthy() >>> c.parseFile(filePath) >>> #_DOCS_SHOW c.stream.show() ''' from music21.noteworthy import translate as noteworthyTranslate self.stream = noteworthyTranslate.NoteworthyTranslator().parseFile(fp)
def parseData(self, nwcData): r'''Open Noteworthy data from a string or list >>> nwcData = ("!NoteWorthyComposer(2.0)\n|AddStaff\n|Clef|" + ... "Type:Treble\n|Note|Dur:Whole|Pos:1^") >>> c = converter.subConverters.ConverterNoteworthy() >>> c.parseData(nwcData) >>> c.stream.show('text') {0.0} <music21.stream.Part ...> {0.0} <music21.stream.Measure 0 offset=0.0> {0.0} <music21.clef.TrebleClef> {0.0} <music21.note.Note C> ''' from music21.noteworthy import translate as noteworthyTranslate self.stream = noteworthyTranslate.NoteworthyTranslator().parseString(nwcData)
def toStream(self): from music21.noteworthy import translate nwt = translate.NoteworthyTranslator() s = nwt.parseList(self.dumpToNWCText()) return s