Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Recent changes
Random page
Help about MediaWiki
Special pages
LilyPond wiki
Search
Search
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Retuning to a regular temperament
Page
Discussion
English
Read
Edit
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit
Edit source
View history
General
What links here
Related changes
Page information
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
LilyPond holds all the information for meantone temperaments or near-Pythagorean intonations. The default tuning is for 12 note equal temperament. This snippet changes that, and can be placed in an include file to work with pre-existing files. Key signatures are not supported. The MIDI output works as well as any case of microtuning. Chords need to be split into separate voices. The example is a single line of rising pitches. The tuning is specified as the number of steps to the octave for an equal temperament. Everything follows the nearest fifth to just in that equal temperament. <lilypond version="2.24.0" full> %% http://lsr.di.unimi.it/LSR/Item?id=752 % If you want pitchnames other than English, change the include. % For tunings other than 31 note equal temperament, change the "31". \include "english.ly" tuning = #31 % Resets LilyPond's "default scale" containing the pitch of each % unaltered note (the C major scale). #(define (retune-nominals ET) (ly:set-default-scale (ly:make-scale (list->vector (map (lambda (fifths octaves) (* 6 (+ (* fifths (best-fifth ET)) octaves))) '(0 2 4 -1 1 3 5) '(0 -1 -2 1 0 -1 -2)))))) % Finds the best size of fifth in the equal temperement with % the given number of fifths to the octave. % Note: the effective equal temperament may end up larger. % For example, ask for 12 and "quartertones" will give you 24. #(define (best-fifth ET) (/ (inexact->exact (round (* ET 0.5849625007))) ET)) % Takes the association of pitch names and returns a % new copy where each alteration has the correct value % relative to fifths in the given equal temperament. #(define (retuned-pitchnames pitchnames ET) (map (lambda (pitchname) (let ((pitch (cdr pitchname))) (cons (car pitchname) (ly:make-pitch (ly:pitch-octave pitch) (ly:pitch-notename pitch) (scale-alteration (ly:pitch-alteration pitch) ET))))) pitchnames)) % Takes a list mapping alterations to glyphs % and re-tunes the alterations according to the size of fifth % in the given equal temperament. #(define (retune-glyphs glyphs ET) (map (lambda (glyph) (cons (scale-alteration (car glyph) ET) (cdr glyph))) glyphs)) % Converts an alteration from the initial alteration size % (that would give 12-equal) to the given equal temperament. #(define (scale-alteration alteration ET) (* 12 alteration (- (* 7 (best-fifth ET)) 4))) % Set the innards newglyphs = #(begin (retune-nominals tuning) (ly:parser-set-note-names (retuned-pitchnames pitchnames tuning)) (retune-glyphs standard-alteration-glyph-name-alist tuning)) \score { \new Staff \relative c' { \set Staff.extraNatural = ##f cff4 ctqf cf cqf c4 cqs cs df dqf4 d dqs ds dtqs4 dx e f g4 a bf b c1 \transpose c d \relative c' { cff4 ctqf cf cqf c4 cqs cs df dqf4 d dqs ds dtqs4 dx e f g4 a bf b c1 } } % Apply the new glyphs. \layout { \context { \Score \override Accidental.alteration-glyph-name-alist = \newglyphs \override KeySignature.alteration-glyph-name-alist = \newglyphs \override AccidentalCautionary.alteration-glyph-name-alist = \newglyphs \override TrillPitchAccidental.alteration-glyph-name-alist = \newglyphs \override AmbitusAccidental.alteration-glyph-name-alist = \newglyphs } } \midi {} } \paper { tagline = ##f } </lilypond> [[Category:Pitches]] [[Category:Midi]]
Summary:
Please note that all contributions to LilyPond wiki may be edited, altered, or removed by other contributors. If you do not want your writing to be edited mercilessly, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource (see
Meta:Copyrights
for details).
Do not submit copyrighted work without permission!
Cancel
Editing help
(opens in new window)
Search
Search
Editing
Retuning to a regular temperament
Add topic