Skip to content

Instantly share code, notes, and snippets.

@uliska
Created November 21, 2016 15:53
Show Gist options
  • Save uliska/f12b6c415caa6a51ae1296fae5ac0bae to your computer and use it in GitHub Desktop.
Save uliska/f12b6c415caa6a51ae1296fae5ac0bae to your computer and use it in GitHub Desktop.
Display Just Intonation pitches with LilyPond and the openLilyLIb/ji package
\version "2.19.50"
%
% Examples for pitches in Just Intonation using the openLilyLib/ji package.
% In order to compile this file with LilyPond 2.19 (2.18 does *not* work)
% the oll-core and the ji packages have to be installed from
% https://github.com/openlilylib.
%
% Installing works by downloading or cloning the repostories from
% https://github.com/openlilylib/oll-core and
% https://github.com/openlilylib/ji
% into an arbitrary parent folder on the local disk
% and making this parent directory known to LilyPond's include path
% (either with the -I command line option or with e.g. Frescobaldi's Preferences)
%
% Uncomment to create individual cropped files per example
\include "lilypond-book-preamble.ly"
% Activate the Just Intonation package
\include "ji/package.ily"
\markup "Ratios over middle c, printing cent deviation"
\setOption ji.show.cent ##t
{
\jiNote 1 7/4
\jiNote 3/2
\jiNote 4/3
\jiNote 5/4
}
\markup "Occasionally changing fundamental"
{
\jiNote a, 1 5/1
\jiNote 7/1
\jiNote e, 1 5/1
\jiNote 7/1
}
\markup "Changing fundamental with each note"
{
\jiNote c, 1 4/1
\jiNote bes,, 5/1
\jiNote a,, 6/1
\jiNote g,, 7/1
}
\markup "Displaying ratio instead of cents (fixed fundamental)"
\setOption ji.show.ratio ##t
\setOption ji.show.cent ##f
{
\jiFundamental c,
\jiNote 1 5/1
\jiNote 6/1
\jiNote 7/1
\jiNote 8/1
}
\markup "Displaying ratio instead of cents (changing fundamental)"
{
\jiNote g, 1 5/1
\jiNote e, 6/1
\jiNote cis, 7/1
\jiNote b,, 8/1
}
\markup "Displaying fundamental instead of resulting pitch"
\markup "(same result as previous example)"
\setOption ji.show.notehead ##f
\setOption ji.show.fundamental ##t
{
\clef bass
\jiNote g, 1 5/1
\jiNote e, 6/1
\jiNote cis, 7/1
\jiNote b,, 8/1
}
\markup "Displaying fundamental and result, one one or two staves"
% Activate some logic to automatically print on two staves
\useCrossStaff
\score {
<<
\new PianoStaff <<
% In order to print on two staves we are responsible ourselves to provide
% an upper staff and to keep it alive. This limitation may be removed in the
% future but for now it is necessary.
% The name is pre-configured in the ji package but can be changed with
% \setOption ji.conf.cross-stuff.upper-name
\new Staff = "ji-upper" {
s1*2
}
\new Staff = "lower" {
\clef bass
% Switch display of result on again
% (has been removed for the previous example)
\setOption ji.show.notehead ##t
% switch on cent display (ratio is already on)
\setOption ji.show.cent ##t
% configure the style of the notehead
% (not discussed in the paper)
\setOption ji.show.notehead-style #'harmonic
\jiNote c, 2 7/1
\setOption ji.show.ratio ##f
\jiNote 4 6/1
\setOption ji.show.ratio ##t
\setOption ji.show.cent ##f
% Switch off cross-staff: resulting pitch will be displayed as a chord
% on the same staff as the fundamental
\setOption ji.conf.use-cross-staff ##f
\jiNote 5/1
\change Staff = "ji-upper"
\jiNote c' 2 7/4
\setOption ji.show.cent ##t
\setOption ji.show.ratio ##f
\jiNote d' 3/2
}
>>
>>
}
% Page formatting, align markup with staff
\paper {
indent =0
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment