PDF output file path

I am needing to specify the file path for the produced PDF from:

s.start_transcribing()
...

performance = s.stop_transcribing()
performance.to_score(title="Title", composer="Me").show()
exit()

I see that you can specify file path for JSON, Lilypond (.ly), and XML but is there a way to specify the file path for the PDF or is this a limitation from abjad.show() ?

This is a good question, and there is a way of doing it in abjad, but I haven’t built it into scamp yet. And it’s also changing with abjad 3.2, which I need to update scamp to deal with. For now, with abjad 3.1, if you have you scamp Score object in the variable score, run:

import abjad
abjad.persist(score.to_abjad_lilypond_file()).as_pdf("path/to/pdf/file.pdf")

Hopefully that works!

Great!

For my future reference or for if anyone else has the same concern:

from scamp import *
import abjad

s = Session()

#insert whatever your music is
#s.tempo = 60
#goblin = s.new_part("goblin")
#goblin.play_note(72, 1, 1)

performance = s.stop_transcribing()
score = performance.to_score(title="Title", composer="Me")
abjad.persist(score.to_abjad_lilypond_file()).as_pdf("score.pdf")
exit()

Lol, “goblin” is always the best choice of instrument.

1 Like