Re: Intervalic Chord Names

2018-08-29 Thread Aaron Hill

On 2018-08-29 10:25, Tom Swan wrote:

continued reply... Re: accidentals, yes that will be necessary. Do you
have an idea about how to go about that?


Hi Tom,

Building upon the code from scm/chord-name.scm (and related files) as 
well as (LSR #750)[1], here is a more complete version of the 
interval-based chord root namer:


[1]:http://lsr.di.unimi.it/LSR/Item?id=750

```lilypond
\version "2.18.2"

#(define (intervalic-namer pitch lowercase?)
  (let ((handle-case (if lowercase? string-downcase (lambda (x) x)))
(alt (ly:pitch-alteration pitch)))
(make-line-markup (list
  (make-simple-markup (handle-case
(vector-ref #("I" "II" "III" "IV" "V" "VI" "VII")
  (ly:pitch-notename pitch
  (if (= 0 alt) empty-markup
(alteration->text-accidental-markup alt))

#(define (intervalic-namer-custom-alts pitch lowercase?)
  (let ((handle-case (if lowercase? string-downcase (lambda (x) x)))
(alt (ly:pitch-alteration pitch))
(custom-alts `((,FLAT . "b") (,SHARP . "#"
(make-line-markup (list
  (make-simple-markup (handle-case
(vector-ref #("I" "II" "III" "IV" "V" "VI" "VII")
  (ly:pitch-notename pitch
  (if (= 0 alt) empty-markup
(make-small-markup (make-raise-markup 0.7 (make-text-markup
  (ly:assoc-get alt custom-alts "?")

theChords = \chordmode { c8 d/fis e:m7 f:maj7 g:7 a:m bes:sus4 b:dim 
}

\score { << \new ChordNames \chordmode {
  \omit Score.BarNumber
  \override Score.RehearsalMark.self-alignment-X = #-1
  \mark "Default naming"
  \theChords \break
  \mark "Interval-based naming"
  \set chordRootNamer = #intervalic-namer
  \theChords \break
  \mark "Lowercase minor"
  \set chordNameLowercaseMinor = ##t
  \theChords \break
  \mark "Custom alterations"
  \set chordRootNamer = #intervalic-namer-custom-alts
  \theChords
} >> \layout { indent = 0 } }
```

The above namer comes in two flavors, depending on whether you prefer 
the normal glyphs for alterations or if you want to customize the 
symbols.


The one thing this does not handle is ensuring the tonic of the current 
key signature appears as "I".  To do that appears to require more work 
as `chordRootNamer` does not provide access to the context in order to 
query for the current key.  I believe you might need to go down the 
route of a custom engraver.  If you search on this mailing list, there 
has been prior discussion about supporting the Nashville numbering 
system (which admittedly is much more than just interval-based naming).  
But in that thread, there is a lot of potentially relevant material to 
this topic, such as getting the key signature information into the 
ChordNames context.


-- Aaron Hill

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Intervalic Chord Names

2018-08-29 Thread Tom Swan
continued reply... Re: accidentals, yes that will be necessary. Do you have an 
idea about how to go about that?

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Intervalic Chord Names

2018-08-29 Thread Tom Swan
That worked perfectly! Thank you. I am not very familiar with lilypond 
internals, but now I am also intrigued by your solution. I am determined now to 
learn scheme. :-)

> 
> Do you need lowercase numbers (i to vii) too? And how about accidentals?
> 

I am comfortable with IVm7 or IV-7 but I am curious how you would select 
lowercase ii, vi, etc.? If the chord is c:m7 would that choose lowercase 
somehow? That would be pretty cool. Now I'm thinking of expanding this to 
respect the key (e.g. if the key is changed to F, would the intervalic chords 
remain unchanged in the output?) I don't really need to do that; just wondering 
aloud.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Intervalic Chord Names

2018-08-28 Thread Malte Meyn



Am 28.08.18 um 18:57 schrieb Jacques Menu Muzhic:

Do I guess it right that you’d like tonality-relative numbers, i.e. V7 for A7 
in D major?


That’s indeed probable. There are two possibilities what to do about that:

1. Get the tonic from the key signature as it is done in these snippets: 
http://lsr.di.unimi.it/LSR/Search?q=tonic

2. Use \transpose to transpose the chords to C.

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Intervalic Chord Names

2018-08-28 Thread Jacques Menu Muzhic
Hello Tom,

Do I guess it right that you’d like tonality-relative numbers, i.e. V7 for A7 
in D major?

JM

> Le 28 août 2018 à 16:27, Malte Meyn  a écrit :
> 
> 
> 
> Am 28.08.18 um 15:29 schrieb Tom Swan:
>> Sorry for duplication but my previous try didn't seem to go through.)
> 
> It came through; it just seems like it was overlooked by many.
> 
>> I need some help figuring out how to change chord names (C, F, G) into 
>> intervals such as (I, IV, V). The short example below displays a timing 
>> diagram for a melodic line, but I would also like to display the chords C7, 
>> F7 as generic intervals I7 IV7. Manually setting the text would okay -- I'm 
>> not looking for some kind of automatic translation, although that would be 
>> neat. I know I can do this with markup, but I do not want to add markup 
>> statements to noteValues! Do I need to set chordRootNamer somehow? Or is 
>> there another solution? Thanks for any advice.
> 
> Setting chordRootNamer probably is the easiest way, yes. I took the original 
> definition of note-name->markup (which is the default chordRootNamer) from 
> the file scm/chord-name.scm and modified it to use the roman numerals I to 
> VII instead of letters C to B:
> 
> %
> \layout {
>  \context {
>\ChordNames
>chordRootNamer =
>#(lambda (pitch lowercase?)
>   (make-simple-markup
>(vector-ref #("I" "II" "III" "IV" "V" "VI" "VII")
>  (ly:pitch-notename pitch
>  }
> }
> %
> 
> Of course you can use that in a \with block instead of a layout-context 
> block; or just \set chordRootNamer = … somewhere else ;)
> 
> Do you need lowercase numbers (i to vii) too? And how about accidentals?
> 
> ___
> lilypond-user mailing list
> lilypond-user@gnu.org
> https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Intervalic Chord Names

2018-08-28 Thread Malte Meyn



Am 28.08.18 um 15:29 schrieb Tom Swan:

Sorry for duplication but my previous try didn't seem to go through.)


It came through; it just seems like it was overlooked by many.


I need some help figuring out how to change chord names (C, F, G) into 
intervals such as (I, IV, V). The short example below displays a timing diagram 
for a melodic line, but I would also like to display the chords C7, F7 as 
generic intervals I7 IV7. Manually setting the text would okay -- I'm not 
looking for some kind of automatic translation, although that would be neat. I 
know I can do this with markup, but I do not want to add markup statements to 
noteValues! Do I need to set chordRootNamer somehow? Or is there another 
solution? Thanks for any advice.


Setting chordRootNamer probably is the easiest way, yes. I took the 
original definition of note-name->markup (which is the default 
chordRootNamer) from the file scm/chord-name.scm and modified it to use 
the roman numerals I to VII instead of letters C to B:


%
\layout {
  \context {
\ChordNames
chordRootNamer =
#(lambda (pitch lowercase?)
   (make-simple-markup
(vector-ref #("I" "II" "III" "IV" "V" "VI" "VII")
  (ly:pitch-notename pitch
  }
}
%

Of course you can use that in a \with block instead of a layout-context 
block; or just \set chordRootNamer = … somewhere else ;)


Do you need lowercase numbers (i to vii) too? And how about accidentals?

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Intervalic Chord Names

2018-08-28 Thread Tom Swan
Hello. (Trying this again in plain text. Sorry for duplication but my previous 
try didn't seem to go through.) 

I need some help figuring out how to change chord names (C, F, G) into 
intervals such as (I, IV, V). The short example below displays a timing diagram 
for a melodic line, but I would also like to display the chords C7, F7 as 
generic intervals I7 IV7. Manually setting the text would okay -- I'm not 
looking for some kind of automatic translation, although that would be neat. I 
know I can do this with markup, but I do not want to add markup statements to 
noteValues! Do I need to set chordRootNamer somehow? Or is there another 
solution? Thanks for any advice.

\version "2.18.2"

globalDefs = {
  \clef "treble_8" 
  \key c \major
  \time 4/4
}

noteValues = {
  a4 a4 a8[ a8] a4 |
  a4 a4 a2 |
  a4 a8[ a8] a4 a4 |
  a2 a8[ a8] a4 \bar "|."
}

chordValues = \chordmode {
  % \set chordRootNamer = ???
  c1:7 f1:7 c1:7 c1:7 
}

\score { << 
  \new ChordNames {
\chordValues 
  }
  \new RhythmicStaff = "Timing" <<
  \new Voice = "Rhythm" {
\globalDefs
\omit RhythmicStaff.Fingering
\improvisationOn
\noteValues
  } % Rhythm Voice 
  >>
>> 
}

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Intervalic Chord Names

2018-08-24 Thread Tom Swan

Hello. I need some help figuring out how to change chord names (C, F, G) into intervals such as (I, IV, V). The short example below displays a timing diagram for a melodic line, but I would also like to display the chords C7, F7 as generic intervals I7 IV7. Manually setting the text would okay -- I'm not looking for some kind of automatic translation, although that would be neat. I know I can do this with markup, but I do not want to add markup statements to noteValues! Do I need to set chordRootNamer somehow? Or is there another solution? Thanks for any advice.\version "2.18.2"globalDefs = { \clef "treble_8" \key c \major \time 4/4}noteValues = { a4 a4 a8[ a8] a4 | a4 a4 a2 | a4 a8[ a8] a4 a4 | a2 a8[ a8] a4 \bar "|."}chordValues = \chordmode { % \set chordRootNamer = ??? c1:7 f1:7 c1:7 c1:7 }\score { <<  \new ChordNames { \chordValues } \new RhythmicStaff = "Timing" << \globalDefs \new Voice = "Rhythm" { \globalDefs \omit RhythmicStaff.Fingering \improvisationOn \noteValues } % Rhythm Voice   }http://www.tomswan.com
 

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user