def test_to_pdf(self): self.assert_( LilyPond.to_pdf( "{ %s }" % LilyPond.from_NoteContainer(NoteContainer("C"), value.dots(8)), "pdftest first test" ) ) self.assert_(LilyPond.to_pdf(LilyPond.from_Bar(self.tbar), "pdftest2")) self.assert_(LilyPond.to_pdf(LilyPond.from_Bar(self.mbar), "pdftest3"))
def test_to_pdf(self): self.assert_( LilyPond.to_pdf( '{ %s }' % LilyPond.from_NoteContainer(NoteContainer('C'), value.dots(8)), 'pdftest first test')) self.assert_(LilyPond.to_pdf(LilyPond.from_Bar(self.tbar), 'pdftest2')) self.assert_(LilyPond.to_pdf(LilyPond.from_Bar(self.mbar), 'pdftest3'))
def test_to_pdf(self): self.assertTrue( LilyPond.to_pdf( "{ %s }" % LilyPond.from_NoteContainer(NoteContainer("C"), value.dots(8)), "pdftest first test", ) ) self.assertTrue(LilyPond.to_pdf(LilyPond.from_Bar(self.tbar), "pdftest2")) self.assertTrue(LilyPond.to_pdf(LilyPond.from_Bar(self.mbar), "pdftest3"))
def testingLilypond(): n = [ "A", "B", "C", "A", "B", "D", "D", "D", "E", "A", "B", "C", "A", "B", "C", "A", "B", "C", "A", "B", "C", "A", "B", "C", "C-5" ] b = mingus.containers.Bar() track = mingus.containers.Track() for i in n: track.add_notes(i) trackString = lilypond.from_Track(track) lilypond.to_pdf(trackString, "Piece")
def save_and_print(treble_track, bass_track): ly_input = """ \header { composer = "Zhang Transcriber 2016" tagline = "Music engraving by LilyPond 2.18.2. Note identification algorithm by Oliver Zhang." } \\new PianoStaff << \\new Staff { \clef treble %s } \\new Staff { \clef bass %s } >> """ % (LilyPond.from_Track(treble_track)[1:-1], LilyPond.from_Track(bass_track)[1:-1]) LilyPond.to_pdf(ly_input, "my_first_bar") webbrowser.open_new(r'file://' + os.path.realpath("my_first_bar.pdf"))
def write_mingus(self, outfile): notes = list(self.timeseries['Notes']) t = Track() for n in range(len(notes)): if n % 4 == 0: b = Bar(self.key, (4, 4)) if notes[n] != 'Z': b + notes[n] else: b + None if (n + 1) % 4 == 0: t + b self.composition + t self.track = t lily_composition = LilyPond.from_Composition(self.composition) print lily_composition LilyPond.to_pdf(lily_composition, outfile)
async def run(self): while await self.receive(): # flush messages pass c = Composition() c.set_author("amg") c.set_title(CFG.OUTPUT_PREFIX + self.agent.name) c.add_track(self.agent.get("melody_track")) c.add_track(self.agent.get("accompaniment_track")) # fluidsynth.init("4U-Yamaha C5 Grand-v1.5.sf2", "alsa") # fluidsynth.play_Composition(c) midi_file_out.write_Composition( CFG.OUTPUT_FOLDER + CFG.OUTPUT_PREFIX + self.agent.name + ".mid", c, CFG.SONG_TEMPO) l = lilypond.from_Composition(c) extra = " \\score { \\new PianoStaff << \\set PianoStaff.instrumentName = #\"Piano \" \\new Staff = \"upper\" \\upper \\new Staff = \"lower\" \\lower >> \\layout { } }" l2 = l.replace("{ {", "upper = {x {x", 1).replace( "{ {", "lower = { {", 1).replace("{x {x", "{ {", 1) + extra # print("<lilipond-"+CFG.OUTPUT_FOLDER+CFG.OUTPUT_PREFIX+self.agent.name+">\n"+l2) lilypond.to_pdf( l2, CFG.OUTPUT_FOLDER + CFG.OUTPUT_PREFIX + self.agent.name) self.agent.presence.set_presence( state=PresenceState(available=True, show=PresenceShow.AWAY)) self.set_next_state(S_FINISHED)
def to_Sheet(bars, chords, track, key, mode, file, out_dir, title, author): path = out_dir + '/' + file.split('.')[0] file = file.split('/')[-1] track = LilyPond.from_Track(track) track = track[1:-1] track = '\\header {title= "' + title + '" composer = "' + author + '"} \nmelody = {\n\\key ' + key.lower( ) + ' \\' + mode + '\n' + track + '''} harmonies = \\chordmode {''' + get_Shorthands( determine_chords(chords)) + '''}\n \\score {\n <<\n \\new ChordNames {\n \\set chordChanges = ##t\n''' + determine_clef(bars) + ''' \\harmonies\n }\n \\new Staff \\melody >>\n \\layout{ } \n \\midi { }\n }''' LilyPond.to_pdf(track, path) if os.path.exists(path + '.midi'): os.remove(path + '.midi')
def test_to_pdf(self): self.assert_(LilyPond.to_pdf('{ %s }' % LilyPond.from_NoteContainer(NoteContainer('C'), value.dots(8)), 'pdftest first test')) self.assert_(LilyPond.to_pdf(LilyPond.from_Bar(self.tbar), 'pdftest2')) self.assert_(LilyPond.to_pdf(LilyPond.from_Bar(self.mbar), 'pdftest3'))