0.0
No release in over a year
This gem provides a library to access and control Lilypond within Ruby. It also provides a builder tool for generating LilyPond files dynamically with Ruby.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 1.15, >= 1.15.5
 Project Readme

LilyPond Ruby

Gem Version GitHub version

LilyPond Ruby is a Ruby library for controlling LilyPond, a music notation software. It allows LilyPond files, compile them into various formats (such as PDF or MIDI), and access LilyPond's various functions and features through Ruby code.

Installation

Download and install LilyPond from http://lilypond.org/download.html

To install LilyPond Ruby, run the following command:

gem install LilyPond-Ruby

Or add this line to your application's Gemfile:

gem "LilyPond-Ruby"

And then execute:

bundle install

Configuration

I built this gem with Rails in mind, so in my app's config/initializers directory I added the lilypond.rbfile with the following information:

require "lilypond-ruby"

LilyPond.configuration do |config|
  config.default_output = :pdf # options: [:pdf, :svg, :png]
  config.destination_directory = Rails.root.join("storage", "lilypond") # Where the output files will go.
  config.lilypond_path = Rails.root.join("public", "lilypond-2.24.1", "bin", "lilypond") # wherever your LilyPond installation command lives.
end

Usage

Here's an example of how to use LilyPond Ruby to generate a PDF file from a LilyPond file:

require 'lilypond-ruby'

lilypond_code = File.read('score.ly')
file_name = 'score.ly'

LilyPond.generate_with_lilypond(file_name, lilypond_code, :pdf)

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/Okomikeruko/LilyPond-Ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.