35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/mtk/io/notation.rb', line 35
def write(timeline)
lilypond_syntax = syntax_for_timeline(timeline)
puts lilypond_syntax
puts "_____________________________"
Tempfile.open('mtk_lilypond') do |lilypond_file|
Dir.mktmpdir do |tmpdir|
lilypond_file.write(lilypond_syntax)
lilypond_file.flush
cmd = ['lilypond', '-dbackend=eps', "-f#{@format}", "--output=\"#{tmpdir}\""]
cmd << "-dresolution=#{@dpi}" if @dpi
cmd << lilypond_file.path
cmd = cmd.join(' ')
puts cmd if $DEBUG
lilypond_command_output = `#{cmd}`
puts lilypond_command_output if $DEBUG
output_file = Dir["#{tmpdir}/*.#{@format}"].first
FileUtils.cp output_file, @file
puts "Wrote #{@file}"
end
end
end
|