Re: Scheme question
Stefano, That works perfectly. The Cond conditional is even better. Thank you, Jay -- Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Scheme question
I have defined three pair lists nameCpitch, nameEpitch, nameGpitch and nameApitch. I want to assign nameold to one of the four depending on the value of pitch. I set pitch to G and have a set of if statements to define nameold. However it is not working. When I print one of the lists I defined, it prints correctly but the list nameold does not. I imagine that someone who knows scheme could spot my error immediately. Here is the code \version "2.19.83" nameCpitch = #`(("c" . "C") ("cis" . "C#") ("des" . "Db") ("d" . "D") ("b" . "B") ("bis" . "B#")) nameEpitch = #`(("c" . "E") ("cis" . "F") ("des" . "F") ("d" . "F#") ("b" . "D#") ("bis" . "E")) nameGpitch = #`(("c" . "G") ("cis" . "Ab") ("des" . "Ab") ("d" . "A") ("b" . "F#") ("bis" . "G")) nameApitch = #`(("c" . "A") ("cis" . "Bb") ("des" . "Bb") ("d" . "B") ("b" . "G#") ("bis" . "A")) pitch = G #(define nameold (if (equal? pitch "C") (nameCpitch (if(equal? pitch "E") (nameEpitch (if (equal? pitch "G") (nameGpitch (if (equal? pitch "A") nameApitch nameCpitch #(display nameCpitch) #(display nameold) %% ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Multiple context NoteNames
Wow! Fantastic! Thanks Aaron! -- Sent from: http://lilypond.1069038.n5.nabble.com/User-f3.html ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Multiple context NoteNames
I have defined alternate note names using the following method: newnames = #`(("c" . "S") ("d" . "R") ("e" . "G") ("f" . "M") ("g" . "P") ("a" . "D") ("b" . "N")) myNoteNames = #(lambda (grob) (let* ((default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames))) (ly:grob-set-property! grob 'text new-name) (ly:text-interface::print grob))) geetam = \relative c' { e4 e g2 g a4 g c2 c } \new Staff << \geetam \context NoteNames \with { \override NoteName #'stencil = #myNoteNames } { \geetam} >> This works perfectly. Now, some of the student also want to see the names of notes C, D, E, F, G, A, B. Is there a way to show both the note names I have defined and the english note names? Ideally, one would be below the other. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Scheme / Lilypond question
1) Is it possible to define a variable as a piece of music: jj = g16 \3 ( f e f) The idea is, in the music I am working on the note F is sometimes replaced by the above [and similarly other notes]. Perhaps a scheme function may be needed for this? 2) When I am specifying the guitar string the note is to be played on, it turns out I need to specify it for each and every note. Is there a way to specify it easily? Say, StrThree { g16 (f e f)} would mean all the notes should be played on string three. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Music or Scheme function to Auto Generate glissandos
Wow! That works! Thanks. -- View this message in context: http://lilypond.1069038.n5.nabble.com/Music-or-Scheme-function-to-Auto-Generate-glissandos-tp189566p189597.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Music or Scheme function to Auto Generate glissandos
I have some music where I have Glissandos between each note of a phrase. This happens often enough to warrant a Music of Scheme function that takes a piece of music and adds glissandos between the notes. In the example code below, for example, such a function would take music and convert it musicsl. %% \version "2.19.39" music = \relative c' {c8 (d e f g)} musicsl = \relative c' { c8 (\glissando d \glissando e \glissando f \glissando g)} \new Staff { \music} \new Staff {\musicsl} I tried working with the snippet that adds articulations http://lsr.di.unimi.it/LSR/Snippet?id=82, but was not sure how to proceed. Is there a function already that does this? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Left Hand Fingerings on Guitar Tab
Works perfectly. Thanks. -- View this message in context: http://lilypond.1069038.n5.nabble.com/Left-Hand-Fingerings-on-Guitar-Tab-tp189370p189391.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Left Hand Fingerings on Guitar Tab
I am trying to add left hand fingerings to the Tablature without affecting the staff. Here is a sample code: \version "2.19.15" one = \markup { \finger 1 } two = \markup { \finger 2 } three = \markup { \finger 3 } four = \markup { \finger 4 } myMusic = \relative c'' { c ^\one c d ^\three g ^\three } \score { << \new Staff { \myMusic } \new TabStaff { \tabFullNotation \transpose c'' c' \myMusic } >> } = It does show the left hand fingerings on both the staff and the Tablature [image: Inline image 1] Is there a way to suppress the fingerings on the staff and have it show up only in the Tablature? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Colouring guitar strings
Marc, that is perfect. Let me try and figure out how to adapt it to guitar tabs. -- View this message in context: http://lilypond.1069038.n5.nabble.com/Colouring-guitar-strings-tp183220p183233.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Colouring guitar strings
Is there a way to have the guitar staff lines colour-coded? That is, have each line in a different colour? There is a snippet that allows you to change the thickness of staff lines. Something along the same lines perhaps could be available. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: [OT] solfege to notes software?
All music in Carnatic Classical music is written in solfege. Not sure if this is an example of what you are talking about. Plus there is no specific standard, but rather a bunch of different conventions. And the ornamentations are left to the performer and not specifically written. Timing is handled - all solfeges are quarter notes, a comma extends it to a half note, and a semicolon extends it by one note. Eighth, sixteenth, etc notes are obtained by adding one or more underlines to the solfege. Measures are seperated by vertical bars, with dotted bars used for sub-measures. If we were to use the solfege {sa ri ga ma pa da ni} for {c d e f g a b}, then c4 d2 e1 would be written sa ri, ga,; where sa is a c4, ri, is d2 and ga,; is e1. The same three notes with an underline covering all three notes would be - c8 d4 e2. With two underlines, c16 d8 e4 and so on. ga; would be e2. (dotted note). Also, the solfeges are in lilypond terms absolute, with the higher octaves represented with a dot on top of the solfeges and the lower octaves with a dot below. Another complication is that the solfege frequencies are only fixed relative to each other. I essentially use a combination of programs to get the solfege to lilypond format. Depending on the accuracy of the original writers of the solfeges, the results are not bad. There are 72 key signatures, and I ended up defining these in lilypond itself. -- View this message in context: http://lilypond.1069038.n5.nabble.com/OT-solfege-to-notes-software-tp169427p169434.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Problems with Completion_heads_engraver
For some reason the Completion heads engraver does not seem to be working in some situations. In some cases it swallows up a note (although timing wise it seems ok) and sometimes it produces some weird looking notes. Here is one example I was able to recreate in a small example: [image: Inline image 1] Here is the code: %%% %%% \version 2.19.15 music = \relative c' {d4 c e fis1 g4 } \score { \new Staff { \music } \layout { \context { \Staff \remove Note_heads_engraver \consists Completion_heads_engraver } } } % % ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming question
Yay! That works. Not sure why the other way did not work. I tried various ways of getting it to output to a string instead of to a file, something like: #(set! (jv (with-output-to-string (lambda () #{ \displayMusic \music #} so that we could add the # to the string jv. No luck here as I could not get past the syntax / non-music expression issues. On Wed, Nov 26, 2014 at 12:41 AM, David Nalesnik david.nales...@gmail.com wrote: On Tue, Nov 25, 2014 at 8:49 AM, Jay Vara j...@diljun.com wrote: Trying to force the lyric in David's program to associate with the Staff/Voice, I added a name jun to the voice and see if that worked. [...] In this case, the lyrics, that is the pitch numbers, did not show up at all! Wonder why? I think it's because \music gets interpreted and forces the creation of a new higher-level context, but I'm pretty fuzzy here. I wonder if there's a way to parse \music without any side effects. I see various Scheme functions relating to the parser, but I'm pretty unfamiliar with this area. Would ly:parser-clone get us somewhere? Anyway, here's an interesting experiment. First, I created a text file display.txt with the Scheme expression for \music. I did this by running the file out.ly. I then added a # in front of the expression in the text file. Unsure of how to automate that. Next, I included the contents of the text file in the main file ( another.ly) like so: \new Staff \new Voice = jun \music \noteNameToLyric \extractPitches \include display.txt And, like magic, it works! --David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming question
Trying to force the lyric in David's program to associate with the Staff/Voice, I added a name jun to the voice and see if that worked. noteNameToLyric = #(define-void-function (parser location lst) (list?) (let* ((str (t lst)) (str (string-append { str }))) (display str) (newline) (ly:parser-include-string parser (string-append \\new Lyrics \\lyricsto \jun\ str music = \relative c' { c4 d e f g a b c } \new Staff \new Voice = jun \music \noteNameToLyric \extractPitches \music In this case, the lyrics, that is the pitch numbers, did not show up at all! Wonder why? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming question
This version seems to work. You are creating a list of lyric-events to be fed to the parser rather than a string - is that the difference? Hopefully I can understand your code within a few days. Interestingly, b-flat is coming out as b rather than bes. Or rather b is shown as b-flat on the staff. On Tue, Nov 25, 2014 at 5:54 PM, Thomas Morley thomasmorle...@gmail.com wrote: 2014-11-25 15:49 GMT+01:00 Jay Vara j...@diljun.com: Trying to force the lyric in David's program to associate with the Staff/Voice, I added a name jun to the voice and see if that worked. noteNameToLyric = #(define-void-function (parser location lst) (list?) (let* ((str (t lst)) (str (string-append { str }))) (display str) (newline) (ly:parser-include-string parser (string-append \\new Lyrics \\lyricsto \jun\ str music = \relative c' { c4 d e f g a b c } \new Staff \new Voice = jun \music \noteNameToLyric \extractPitches \music In this case, the lyrics, that is the pitch numbers, did not show up at all! Wonder why? Hi, I couldn't get David's code to work either, would have been very elegant. Though, attached my own attempt using Davids work and some recyceled own codings. Several comments inline. And you'll still find some TODOs HTH, Harm ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Programming question
Given that NoteNames are really a type of lyrics, is it possible to have a function that just takes music and returns a text string that is a lyric. For example: music = \relative c' { c4 d e f g a b c } notenameLyric = \NoteNameToLyric \music would make notenameLyric = c d e f g a b c so that we can write \newLyric \lyricmode \notenameLyric I understand that such a function would probably map the music and extract the 'text from it and concatenate it to get the result. Not yet successful in getting it to work. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Replace slur events with skip
I tried to change the tiedNoteToSkip procedure to also skip slurs. For some reason, it does not seem to work the same way. It skips the first note in a 3 note slur, but not the second. Here is the script: \version 2.19.15 #(define (name-of music) (ly:music-property music 'name)) tiedNoteToSkip = #(define-music-function (parser location music) (ly:music?) (let ((prev-was-tie? #f)) (map-some-music (lambda (evt) (cond ((memq (name-of evt) '(EventChord NoteEvent)) (let ((old-flag prev-was-tie?)) (set! prev-was-tie? #f) (let ((res (music-filter (lambda(x) (or (not (or (eq? (name-of x) 'SlurEvent) (eq? (name-of x) 'TieEvent))) (begin (set! prev-was-tie? #t) #f))) evt))) (if old-flag (skip-of-length evt) res (else (ly:music-property music 'duration #f music))) music = \relative c' {e4 e8 ( d16 e16) g2 g g16 (c16 a8) g4 c4 ~c~ c} mus = \tiedNoteToSkip \music \score { \new Staff { \new Voice { \music } \context NoteNames { \mus } } \layout { \context { \Voice %\consists \SarigamaEngraver \remove Note_heads_engraver \remove Rest_engraver \consists Completion_heads_engraver \consists Completion_rest_engraver } } } [image: Inline image 1] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: how to get h instead of b in notenames
Apparently, in the NoteNames context it defaults to Dutch. You can use the following code to get what you want I think. b has been redefined to h in the definition of newnames and the myNoteNames override to NoteName.stencil makes this substitution. %%% \version 2.18.2 \language deutsch onthelines = \relative e' { e1 g h d f } newnames = #`((c . c) (d . d) (e . e) (f . f) (g . g) (a . a) (b . h) ) myNoteNames = #(lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) ) ;; body (ly:grob-set-property! grob 'text new-name) (ly:text-interface::print grob) ) ) \score { \new Staff \onthelines \new NoteNames \with { \override NoteName.stencil = #myNoteNames } {\onthelines} } % http://lilypond.1069038.n5.nabble.com/file/n168383/germanNote.jpg -- View this message in context: http://lilypond.1069038.n5.nabble.com/how-to-get-h-instead-of-b-in-notenames-tp168372p168383.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Unicode Font Issues
Yes, you are right. The unicode fonts failed on 2.19.5. I even tried the new windows 10 and it failed. Now that I know it works on linux (thanks to Bric), I will try to get access to linux using virtual box and try it out. On Sat, Nov 1, 2014 at 2:08 PM, Werner LEMBERG w...@gnu.org wrote: If it works on Linux, I may have a way to get Linux on the windows PC using Virtual Box. On the other hand I am using version 2.18.2 - perhaps I should try 2.19.5 first. I fear that 2.19.5 will fail on Windows as 2.18.2 does. Werner ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Unicode Font Issues
If it works on Linux, I may have a way to get Linux on the windows PC using Virtual Box. On the other hand I am using version 2.18.2 - perhaps I should try 2.19.5 first. -- View this message in context: http://lilypond.1069038.n5.nabble.com/Unicode-Font-Issues-tp168122p168243.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Accidental Notes in different colour
Paul, Is there a similar way to get at the accidental grob from the NoteNames? I tried a similar method by overriding the NoteNames.stencil and giving the NoteName a colour there. When I do an (accidental (ly:grob-object grob 'accidental-grob)), it always comes up with null. Also, I have several key signature changes in my music and I realised that by the time Lilypond gets to printing the NoteNames, it seems to have lost knowledge of the key signatures and only remembers the very last one. Jay -- View this message in context: http://lilypond.1069038.n5.nabble.com/Accidental-Notes-in-different-colour-tp168088p168244.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Accidental Notes in different colour
Paul, Thanks. I modified the snippet and was able to get it half-way working. I say half-way because I was not able to get the Stem and the Accidental to change colour, just the NoteHead. Well, not quite. I tried this function on a long music and it changed the colour of the stem here and there - not consistently. Perhaps we are catching the stem after it has already been printed? I tried also to set the Stem colour directly, but the grob for the Stem does not seem to have the accidental information. Here is the code I used: %%% \version 2.18.2 #(define (color-acci notehead) (let* ((accidental(ly:grob-object notehead 'accidental-grob)) (notecolumn (ly:grob-parent notehead X)) (stem (ly:grob-object notecolumn 'stem))) ; (format #t head = ~a acci = ~a stem = ~a ?? ~% notehead accidental stem) (if (ly:grob? accidental) (ly:grob-set-property! stem 'color red)) (if (ly:grob? accidental) (ly:grob-set-property! accidental 'color red)) (if (ly:grob? accidental) red black))) #(define (color-stem stem) (let* ((accidental(ly:grob-object stem 'accidental-grob))) (format #t acci = ~a stem = ~a ?? ~% accidental stem) (if (ly:grob? accidental) red black))) \score { \new Staff \relative c' { \override NoteHead.color = #color-acci \override Stem.color = #color-stem c4 b d dis ees f g aes } } %%% Here is the output: http://lilypond.1069038.n5.nabble.com/file/n168111/Color-Acci.jpg -- View this message in context: http://lilypond.1069038.n5.nabble.com/Accidental-Notes-in-different-colour-tp168088p168111.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Unicode Font Issues
I tried to use unicode fonts for the lyrics. While the fonts show perfectly well in the input file, the output is not correct. Is there a workaround? %% \version 2.18.2 \score { \new Staff \relative c' { {c2 d4e f2 g a b c} \new Lyrics \lyricmode { ಸಾ ರಿ ಗಾ ಮಾ ಪಾ ದಾ ನೀ ಸಾ } } } %%% Here is what it prints and also what it should print. [image: Inline image 1] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Accidental Notes in different colour
Paul Thanks. I modified your snippet and was able to get it to work for the note heads. For some reason the stems and accidentals do not work. I even tried a separate function to set Stem.color - also did not work. The stem does not seem to see accidentals. When I tried the color-acci in my program with many pages of music, it behaved strangely. In some places the stem and accidentals did change colour. In some other places only the note head. Perhaps, we are catching the stem and accidental after they have already been printed in some cases? How to get around that? %% \version 2.18.2 #(define (color-acci notehead) (let* ((accidental(ly:grob-object notehead 'accidental-grob)) (notecolumn (ly:grob-parent notehead X)) (stem (ly:grob-object notecolumn 'stem))) ; (format #t head = ~a acci = ~a stem = ~a ?? ~% notehead accidental stem) (if (ly:grob? accidental) (ly:grob-set-property! stem 'color red)) (if (ly:grob? accidental) (ly:grob-set-property! accidental 'color red)) (if (ly:grob? accidental) red black))) #(define (color-stem stem) (let* ((accidental(ly:grob-object stem 'accidental-grob))) (format #t acci = ~a stem = ~a ?? ~% accidental stem) (if (ly:grob? accidental) red black))) \score { \new Staff \relative c' { \override NoteHead.color = #color-acci \override Stem.color = #color-stem c4 b d dis ees f g aes } } %% ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Accidental Notes in different colour
I am not top-posting Paul, Thanks. I was able to use the snippets you pointed out to get it almost working. Check out this snippet: Using ly:grob-object to access grobs with \tweak http://lsr.di.unimi.it/LSR/Item?id=621 This is the program I wrote. It does colour the note heads for accidental notes, but for some reason fails to colour the stem or the accidental sign. %%% \version 2.18.2 #(define (color-acci notehead) (let* ((accidental(ly:grob-object notehead 'accidental-grob)) (notecolumn (ly:grob-parent notehead X)) (stem (ly:grob-object notecolumn 'stem))) (format #t head = ~a acci = ~a stem = ~a ?? ~% notehead accidental stem) (if (ly:grob? accidental) (ly:grob-set-property! stem 'color red)) (if (ly:grob? accidental) (ly:grob-set-property! accidental 'color red)) (if (ly:grob? accidental) red black))) \score { \new Staff \relative c' { \override NoteHead.color = #color-acci c4 b d dis ees f g aes } } %% ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Accidental Notes in different colour
Jay, Thanks. That works very well. -- View this message in context: http://lilypond.1069038.n5.nabble.com/Accidental-Notes-in-different-colour-tp168088p168120.html Sent from the User mailing list archive at Nabble.com. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How to force NoteNames to be printed before key change
I have a program which is roughly as below: \score { \new staff { \key c \major \new voice { musicA } \context NoteNames { \override NoteName.stencil = #myNoteNames musicA } } \layout{} } \score { \new staff { \key g \major \new voice { musicB } \context NoteNames { \override NoteName.stencil = #myNoteNames musicB } } \layout{} } Two rougly identical blocks, the only difference being the key and music. It appears to me that by the time the NoteNames of musicA prints, the key signature has already changed to G major. I introduced another copy of \key c \major inside the NoteNames context - but still I can see that in #myNoteNames function that the key signature has changed. Is there a way to force NoteNames to print using the key signature defined in its context? The workaround I have is to have each score in a separate .ly file. Not such a good solution since I have many scores in the file. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Accidental Notes in different colour
Is there a way to make the accidental notes in a different colour? I can make a particular note a different colour by: \tweak NoteHead.color #red \tweak Stem.color #red \tweak Accidental.color #red c4 However, I would like to have all the accidentals to be coloured. Perhaps, override NoteHead colouring somehow - not sure how to know if it is an accidental. There is a snippet that shows how to colour based on pitch http://lsr.di.unimi.it/LSR/Snippet?id=572 - I was not able to figure out how to use this to capture accidentals. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How does map-some-music work?
I am trying to display all the names that appear in a piece of music (NoteEvent etc.) using map-some-music. It the function musShow is only printing the top level name. What am I missing here? \version 2.18.2 #(define (showMus music) (display-scheme-music (ly:music-property music 'name Not Defined))) musShow = #(define-music-function (parser location myx ) (ly:music?) (map-some-music (lambda (evt) (showMus evt )) myx) #{ #}) music = {c ~ c} \musShow #music %%% ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How does map-some-music work?
Paul Hi Jay, Did you see my reply here: http://lilypond.1069038.n5.nabble.com/map-some-music-question- tp167241p167250.html Thanks. I will try your suggestions. I was watching this site. http://news.gmane.org/gmane.comp.gnu.lilypond.general For some reason, there were no updates on the sites on the 6th and 7th of Oct. So I missed your reply. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: map-some-music question
I am trying to display all the names that appear in a piece of music (NoteEvent etc.) using map-some-music. It the function musNam is only printing the top level name. What am I missing here? %%% \version 2.18.2 #(define (name-of music) (display-scheme-music (ly:music-property music 'name))) musNam = #(define-music-function (parser location myx ) (ly:music?) (map-some-music (lambda (evt) (name-of evt )) myx) #{ #}) music = {c ~ c} \musNam #music % ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
NoteName Engraver and Ties
Is there a way to tell the NoteName Engraver not to print the notes under ties? Or print a - when the note is tied to the previous note? In the following code, e and g are tied. The NoteName currently prints e e and g g. Instead I would like to see it print e - and g -. %%% \version 2.18.2 music = \relative c' { c d e ~ e f g ~g a b c } \score { \new Voice \music \context NoteNames \music } \layout {} [image: Inline image 1] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
map-some-music question
I am trying to display all the names that appear in a piece of music (NoteEvent etc.) using map-some-music. It the function musNam is only printing the top level name. What am I missing here? %%% \version 2.18.2 #(define (name-of music) (display-scheme-music (ly:music-property music 'name))) musNam = #(define-music-function (parser location myx ) (ly:music?) (map-some-music (lambda (evt) (name-of evt )) myx) #{ #}) music = {c ~ c} \musNam #music % ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Transpose a lilypond file
I have a song.ly file which prints a song. Is it possible for someone to print the song with a transposition, say c to d, without editing the .ly file? Something like: \transpose c d {\include song.ly} ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
The silent s
I have the letter s as a defined pitch abc = #`( (s . ,(ly:make-pitch -1 0 NATURAL) ) which I set as a note name. How do I set a different letter to the silent note s? Also for the rest r? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Transpose a lilypond file
Marc #(define transposeTo (if (defined? 'transposeTo) transposeTo #{ c #})) melody = { ... } chords = {... } \score { \transpose c $transposeTo ...chords ... ...melody ... } Then you simply make a new file song-in-d.ly: #(define transposeTo #{ d #}) \include song.ly Very nice. And easy to add to my existing .ly files. This idea may also work for another issue I have. Different number of music pieces in the score. \musicA \musicB \musicC etc. In some cases only two are defined and in some cases five or six are defined. I should be able to used the defined? construct to handle that. Thanks. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: The silent s
Marc A quick search in the sources shows that at least 's' seems to be hardcoded in lily/parser.yy, so there is no easy way to define another letter instead of 's'. Okay, thanks. I should be able to work around it. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Transpose a lilypond file
Urs #(define transposeTo #{ d #}) \include song.ly Cool solution, I'll take this into my repertoire. You can then factor out the function into a library file. And you could pass the variable on the commandline instead of adding a new file. Being able to call from the command line would be quite interesting. We were going to have a website where someone could get the song sheet plus the corresponding midi with the transpose they want. Would be easy to implement with the command line option. That project is still a few months away. Thanks Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Lyrics only
I saw some discussion of how to get lilypond to print only lyrics from a few years ago. I tried a few things suggested in those posts, but nothing worked well. Does anyone know if a good solution exists? Ideally, NoteNames and Lyrics contexts would print, but staff does not print or occupy space; plus the lyrics and NoteNames would be places horizontally in the same position as if the staff were there. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
String as a command?
Is there a way to execute a string as a command? For example, tt = 45 #(display tt) #(newline) jj = tt = 65 #(display jj) #(newline) tt = #(eval-string jj) #(display tt) #(newline) would display the value 65 for tt, the result of evaluating the string jj. If I define lilyA, lilyB, lilyC to be strings containing lilypond commands, and I have set xyz = lilyA, is there a way to execute xyz? For example, lilyA = \new Voice { music = {a b c d}} or some larger block of lilypond. Need: The score is standardized in an include file, the only thing changing is the music which can be a variable number of sub parts: musicA, musicB, .. , musicN. If in the main .ly file only musicA and musicB are defined, only those two should be in score, etc. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: String as a command?
Robin If I define lilyA, lilyB, lilyC to be strings containing lilypond commands, and I have set xyz = lilyA, is there a way to execute xyz? Does this work? #(ly:parser-include-string parser #'xyz) Maybe this thread is relevant: http://lists.gnu.org/archive/html/lilypond-user/2014-04/msg00602.html From a brief look at the thread, it looks like it might work. I will work on it this weekend to understand it and check it out. Thanks Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Thanks to David Nalesnik and Jan-Peter Voigt
David, I tried your snippet with a different meter and it gives some weird results. It seems to produce additional bars - I changed the bar after the compound meter to double bar so we can see the extraneous bars. And the notes are not placed properly. Am I doing something totally foolish here? \version 2.18.2 musicA = { \compoundMeter #'((2 4) (4 4)) \relative c' { c'2. d4 b2. c4 a2. b4 g2. a4 f2. g4 } } patterning = { \repeat unfold 8 { \set Staff.completionUnit = #(ly:make-moment 2 4) s4. \bar ! \set Staff.completionUnit = #(ly:make-moment 4 4) s4 \bar || } } \score { \new Staff \new Voice \musicA \new Voice \patterning \layout { \context { \Voice \override SpacingSpanner.uniform-stretching = ##t \remove Note_heads_engraver \consists Completion_heads_engraver \remove Rest_engraver \consists Completion_rest_engraver } } } %%% [image: Inline image 1] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Special bar lines at end of a line
I have four bars per line, plus I have double bar lines at the beginning and end of a line as seen in the code below. I tried to get a special bar line at the end of the FirstPart (at the end of the first line) without success. I think I was able to get it in one of the trials, but that made the double bar line at the beginning of SecondPart disappear. As you can see the command \bar |. in the score section is not having any effect. \version 2.18.2 \defineBarLine || #`(|| || ||) musicA = \relative c' { \bar || c4 d e f2 g2 a b c d e4 } musicB = \relative c' {f g f e d c b a c a b a c d e f} patterning = { \repeat unfold 2 {s4*16 \break \bar ||} } \score { \new Staff \new Voice { \mark FirstPart \musicA \bar |. \mark SecondPart \musicB } \new Voice \patterning \layout { \context { \Voice \remove Note_heads_engraver \consists Completion_heads_engraver \remove Rest_engraver \consists Completion_rest_engraver } } } %%% [image: Inline image 1] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Special bar lines at end of a line
Thomas I tried to get a special bar line at the end of the FirstPart (at the end of the first line) without success. What kind of special bar line? Does\defineBarLine || #'(|. || ||) do the job? Not quite. This definition makes all the lines end with the special barline |.. I only wanted it at the end of the FirstPart of music. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Alignment of markups
I am trying to get the text about the two staffs to align. \left-align or \right-align both seem to just give centre align. Here is the code and what it produces. %% \version 2.18.2 \new Voice {\mark \markup {\left-align Left-Align} \relative c' {c d e f g a b c} } \new Voice {\mark \markup {\right-align Right-Align} \relative c' {c d e f g a b c} } \paper {indent = 0\cm} \layout {} %%% [image: Inline image 1] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Alignment of markups
Jay Vara jay at diljun.com writes: I am trying to get the text about the two staffs to align. \left-align or \right-align both seem to just give centre align. I think I got it. I had to use \override Score.RehearsalMark.self-alignment-X = #LEFT ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Line in lyrics to show half or full note
When a lyric syllable corresponds to several notes, it is easy to get a line extending under all the notes concerned. When a lyric syllable corresponds to a single full note (or dotted full or a half note) I would like to see a line the extends from the lyric till the completion of the current note. Here is an example: % \version 2.18.2 \new Voice = melody { \relative c' {c4 d e f g1}} \new Lyrics \lyricsto melody { cee dee eee ef gee} % This is what it produces: [image: Inline image 1] This is what I would like to see with a line showing that the lyric gee extends to the end of the measure: [image: Inline image 2] ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Thanks to David Nalesnik and Jan-Peter Voigt
Hi David, The problem is that the Completion_heads_engraver and the Completion_rests_engraver do not appear to respond to sub-bar patterning, as the following snippet demonstrates: I would need to spend more time with lily/completion-noteheads-engraver.cc to understand what goes on there, but a comment at the head of the file suggests that my snippet should work: Every time process_music () is called and there are note events, we figure out how long the note to typeset should be. It should be no longer than what's specified, than what is left to do and it should not cross barlines or sub-bar units. The gist is, I don't know if it's possible to do what you'd like to do without fixing or enhancing the C++ engravers. --David I initially had the sub-bar dotted lines generated by adding a simultaneous silent voice with bar lines as in {s2 s4 \bar ! s1 \bar |} for the compound time (3 4 4). I had to go the engraver route mainly because Completion_heads_engraver was not working. For now, we know that there is an issue with timing of when we set the measureLength and when Completion heads gets involved. However, for all the compound meters that I am using, it seems to be working. Also, I just saw your next note - that note and rest events do not cross added bar lines. In that case, what do they mean by sub-bar units in lily/completion-noteheads-engraver.cc? If they mean sub-bar units of the compound meter, they should work for your snippet and they do not. Thanks, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Line in lyrics to show half or full note
Trevor Doing this would not be standard notation, so LilyPond does not provide a straight-forward way to achieve it. Yeah, I understand this is not standard notation. I am trying to match up two different notation systems. In some of the Canarese songs that I am working with, it is traditional to draw the line in the lyric to indicate its extent. I suppose that I could convince the traditionalists to get used to a different convention. It would be nice if I could somehow do it. There is also another need - to be able to draw single or double lines underneath notes to indicate 8th or 16th notes - should extend similar to beams. Best Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Function not called in the NoteName context
I am not top-posting I have defined a function sspOn that just sets a variable SSP to 1. It is called from the music expression \music. \music is used in the Voice context as well as in the NoteNames context. However, the function call is made only once. How do I get the function to be called in the NoteNames context? I have a function myNoteNames that works with the NoteNames and I am testing if the variable SSP is set to 1 or not there. It seems to be always zero. % \version 2.18.2 SSP = #0 TSP = #0 sonne = #0 onnu = #1 sspOn = #(define-void-function (parser location) () (format #t Inside sspOn onnu ~a ~% onnu) (set! SSP onnu)) sspOff = #(define-void-function (parser location) () (set! SSP sonne)) newnames = #`((c . S) (d . R) (e . G) (f . M) (g . P) (a . D) (b . N)) #(define (myNoteNames size nsiz) (lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) (cause (event-cause grob)) (duration (ly:prob-property cause 'duration)) (duration-log (ly:duration-log duration)) (notesize nsiz) (notesize (if (equal? TSP 1) 3 (if (equal? SSP 1) 2 nsiz))) (suffix (if (= duration-log notesize) (if (or (string=? (substring default-name 0 1) d) (string=? (substring default-name 0 1) b)) i a) )) ;; half note (text (string-append new-name suffix)) ) (format #t SSP ~a notesize ~a duration ~a new name ~a nsiz ~a ~% SSP notesize duration-log text nsiz) (ly:grob-set-property! grob 'text (markup #:fontsize size text)) (ly:text-interface::print grob) ) )) music = \relative c' {c d e f g2 g4 f \sspOn f e d a' \sspOff a b b} \new Staff { \new Voice { \music } \context NoteNames { \override NoteName.stencil = #(myNoteNames 0 1) \music } } %% ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Thanks to David Nalesnik and Jan-Peter Voigt
David Apparently, the context property completionUnit needs to be set for the engraver to recognize sub-bar groupings. This gets better results: Nice. I did try the completionUnit before, but I was trying to put it in the music section rather than the pattern section and there it would not work because you do not have the luxury of repeat unfold. This method seems to work better, although the engraver is automatic. I wonder two things: (1) Is there a way to combine the notes and rests in the 1/4 division of the bars? Not sure what you mean. (2) Why the inconsistency in the rests in the 3/8 divisions? Quarter-eighth is correct. Why is this reversed the second time? I think what it has done is correct. It is reversed the second time because in that case the first rest is split into eights by the Completion_rest_engraver. Whatever rest occurs on the barline is split and no attempt is made to correct the input. Is this not what you expect? Anyway, hope this helps. It idefinitely helps in many ways. Not only does it help with the immediate problem, it also teaches ways of doing things in lilypod and guile in more depth than the manuals. I am quite thankful for this. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Thanks to David Nalesnik and Jan-Peter Voigt
Hi David, Thank you very much. Now I know how to use the listeners! With your change it seems to work for the two-staff example with (7 4) (1 4) (2 4) meter. This is the only case of compound metre that I commonly use that has a (1 4) as one of the components. Just to be sure, I did check a few other metres, and whenever there is a (1 4) an issue is possible. Typically the problems seem to be in the first few measures. For example, the two staff example with meter = #'((1 4) (2 4)) gives the following. [image: Inline image 2] Best regards Jay On Mon, Sep 29, 2014 at 1:37 AM, David Nalesnik david.nales...@gmail.com wrote: Hi Jay, On Sun, Sep 28, 2014 at 7:24 PM, David Nalesnik david.nales...@gmail.com wrote: Possibly the problem is that the custom engraver is setting measureLength too late for Completion_heads_engraver to use it? That just might be it. The Completion_heads_engraver listens for note-events. So, doing this same with the custom engraver gives us the code below: alternateTiming = #(lambda (sig) (lambda (context) (let ((last-bnum 0)) (make-engraver (listeners ((note-event engraver event) (let* ((bnum (ly:context-property context 'currentBarNumber)) (len (length sig)) ; how many terms in compound meter (pos (modulo bnum len)) (pos (if (= 0 pos) len pos)) ; first bar in pattern, second... (pos-in-list (1- pos)) ; because elements of list are numbered from 0 (desired-measure-len (to-moment (list-ref sig pos-in-list (ly:context-set-property! context 'measureLength desired-measure-len) (format #t bnum = ~a len ~a pos ~a measurelength ~a completion ~a~% bnum len pos (ly:context-property context 'measureLength) (ly:context-property context 'completionUnit)) (if (= pos-in-list 0) (begin (if ( bnum last-bnum) (ly:context-set-property! context 'whichBar ||)) (set! last-bnum bnum)) %%% This appears to work with your two-staff example. How it fares with others, I don't know. Keep your fingers crossed. Note: You're using an older syntax for Scheme engravers. I've adapted this one to use the make-engraver macro that David Kastrup introduced at some point. Best, David ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: LilyPond Enhancement Proposal (with Bounty)
Paul, Why not play with the paper size and margins to get lilypond to do the work for you? Then you may not need to worry about lyrics on top of bar lines etc. This should work for most tablet devices. Some development may be required to properly scale all the elements when working with very small devices. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Thanks to David Nalesnik and Jan-Peter Voigt
I wanted to get bar lines after each sub-meter of a compound meter, and to have Completion_heads_engraver recognize these bar lines and split and tie notes as needed. Thanks to David and Jan-Peter, I was able to change their doubleBarlinesAfterTimeSig engraver to achieve this effect. I still have a little more work to do since some of the moment variables currently have fixed values. The engraver works well as seen in the code below. Again, I do not really understand the significance of why, for example time-signature is set to '() although it does not change in the engraver. Also, when I tried to change the variable last-fraction to last-bnum, it resulted in a syntax error, even after changing the #f to #0. Perhaps someone may know the answer to this. Here is the modified engraver. Currently, it sets up timings of 3/4, 5/4 and 2/4 and puts a double bar at the end of the three measures. Also notice how the double notes are split and tied across the bar lines. Pretty cool, I would say. \version 2.18.0 %{ Based on a Scheme engraver that places double bar lines before time signature changes Provided by Jan-Peter Voigt Presumably written by David Nalesnik %} last-bnum = #0 fs = #(ly:make-moment 3 4) rs = #(ly:make-moment 2 4) ts = #(ly:make-moment 5 4) alternateTiming = #(lambda (context) (let ((time-signature '()) ;not sure why this time-signature is set to '() (last-fraction #f)) ;not sure why I can not change last- fraction to last-bnum `((process-music . ,(lambda (trans) (let ((bnum (ly:context-property context 'currentBarNumber))) (format #t bnum = ~a measurelength ~a ~% bnum (ly:context-property context 'measureLength)) (case (modulo bnum 3) ((1) (ly:context-set-property! context 'measureLength fs) (if ( bnum last-bnum) (ly:context-set-property! context 'whichBar ||) ) (set! last-bnum bnum)) ((0) (ly:context-set-property! context 'measureLength rs)) ((2) (ly:context-set-property! context 'measureLength ts))) ) )) (stop-translation-timestep . ,(lambda (trans) (set! time-signature '() )) music = { \compoundMeter #'((3 4) (5 4) (2 4) ) \relative c' {c d e2 f g4 a2 b c4 b2 a g4 f2 e d c d e f g a b c} } \score { \new Staff \music \layout { \context { \Score \consists #alternateTiming } \context { \Voice \remove Note_heads_engraver \remove Rest_engraver \consists Completion_heads_engraver \consists Completion_rest_engraver } } } \paper { indent = 0\cm } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Thanks to David Nalesnik and Jan-Peter Voigt
I am not top-posting David, All I can say is I am amazed at your expertise. You have already saved me a few days of work! Thank you for the original idea for this engraver and many more thanks for this refinement. Jay Here's an idea to make the engraver more flexible: \version 2.18.0 meter = #'((3 4) (5 4) (2 4)) #(define (to-moment arg) (ly:make-moment (car arg) (cadr arg))) ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Thanks to David Nalesnik and Jan-Peter Voigt
Hi David, Actually, your logic and reasoning were quite correct. Only, the format statement was before the measureLength was set. I moved the format statement after the context-set-property and it now shows that the engraver does successfully reset the meter. I think the real problem is with the Completion_heads_engraver (probably a bug). To illustrate this, I added another line of simultaneous music - the only difference is the 4th note f - quarter note in one case and half note in the other. Here is the what it prints out: [image: Inline image 1] In the top staff, the second measure should have one quarter note and it has a half note (which should have been split and tied). In the third measure it should have had two quarter notes - it has instead only one quarter note. In the bottom staff, the second and third measure have the correct number of quarter notes. However, the a2 note in the third measure is split into two a4 notes and tied! It is looking more like a Completion_heads_engraver bug. Here is the program: \version 2.18.0 meter = #'((7 4) (1 4) (2 4)) #(define (to-moment arg) (ly:make-moment (car arg) (cadr arg))) alternateTiming = #(lambda (sig) (lambda (context) (let ((last-bnum 0)) `((process-music . ,(lambda (trans) (let* ((bnum (ly:context-property context 'currentBarNumber)) (len (length sig)) ; how many terms in compound meter (pos (modulo bnum len)) (pos (if (= 0 pos) len pos)) ; first bar in pattern, second... (pos-in-list (1- pos)) ; because elements of list are numbered from 0 (desired-measure-len (to-moment (list-ref sig pos-in-list (ly:context-set-property! context 'measureLength desired-measure-len) (format #t bnum = ~a len ~a pos ~a measurelength ~a ~% bnum len pos (ly:context-property context 'measureLength)) (if (= pos-in-list 0) (begin (if ( bnum last-bnum) (ly:context-set-property! context 'whichBar ||)) (set! last-bnum bnum)) musicA = { \compoundMeter #meter \relative c' {c d e2 f4 g2 a b c4 b2 a g4 f2 e d c d e f g a b c d4} } musicB = { \compoundMeter #meter \relative c' {c d e2 f g2 a b c4 b2 a g4 f2 e d c d e f g a b c d4} } \score { \new Staff \musicA \new Staff \musicB \layout { \context { \Score \consists #(alternateTiming meter) } \context { \Voice \remove Note_heads_engraver \remove Rest_engraver \consists Completion_heads_engraver \consists Completion_rest_engraver } } } On Sun, Sep 28, 2014 at 10:24 PM, David Nalesnik david.nales...@gmail.com wrote: Hi Jay, On Sun, Sep 28, 2014 at 3:29 PM, Jay Vara j...@diljun.com wrote: David, If I use the compound meter which has a (1 4) as one of the moments, it does not work. It seems to be treated as a (2 4). Actually, I think the Completion_heads_engraver may be the one with a problem. I checked by varying the music and for situations where the Completion_heads_engraver did not have to create a tie in the (1 4) measure, it was OK. meter = #'((7 4) (1 4) (2 4)) I This makes my head hurt, and my reasoning may need straightening out... Taking a shorter example: meter = #'((3 4) (2 4)) used with music = { \compoundMeter #meter \relative c' {c1 c4} } suggests to me that the problem happens when the engraver doesn't successfully reset the meter. The log for the above values is: bnum = 1 measurelength #Mom 5/4 bnum = 2 measurelength #Mom 3/4 bnum = 2 measurelength #mom 1/2 bnum = 3 measurelength #Mom 1/2 So measureLength of the first bar is 5/4--that is, the sum of the terms of the compound meter, which is what was assigned by \compoundMeter #meter. The meter has not been reset. There needs to be a second note within the proposed first division of 3/4 for the new meter to take effect. meter = #'((3 4) (2 4)) \relative c' {c2 c2} The log shows that the measureLength of the first measure is reset: bnum = 1 measurelength #Mom 5/4 bnum = 1 measurelength #Mom 3/4 bnum = 2 measurelength #Mom 3/4 bnum = 2 measurelength #mom 1/2 At the moment, my head is too tangled up to do something positive with this information. I hope it will help, in any case. --David. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Generating symbols from strings
Robin The following seems to read out the value of abc: xyz = #(eval (string-symbol abc) (interaction-environment)) Wow, that works! Thanks. Working with the idea from Robin, I was able to convert a string to a symbol and evaluate it. I tried to make this into a function. For some reason it is not working. In the following, the first definition of xyz, and the use of par in the 2nd format work fine. The second definition of xyz using the function test is giving me the error: In expression ((eval # #)): Wrong type to apply: parava. The eval itself should have evaluated to this string. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Generating symbols from strings
Robin This also seems to do what you want: xyz = #(eval-string abc) That makes it even easier to follow. Thanks, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Guile question
I am trying to define a function test that takes a string and returns the value of the variable the string represents. For example, if aaa = 25, then bbb = \test aaa would be the same as bbb = \aaa. If I use the eval-string command directly, it is working fine. When I try to put it in a function, it comes up with the error wrong type as below: \version 2.18.2 test = #(define-scheme-function (parser location raga) (string?) (format #t Inside function raga = ~a ~% raga) ((eval-string raga))) abc = IamJustAText ab = enna ennac = parava xyz = #(eval-string (string-append ab c) ) #(format #t 1) abc = ~a xyz = ~a ~% abc xyz) % This prints: 1) abc = IamJustAText xyz = parava par = abc #(format #t 2) abc = ~a xyz = ~a par = ~a ~% abc xyz (eval-string par) ) % This prints ) abc = IamJustAText xyz = parava par = IamJustAText xyz = \test #(string-append ab c) % This gives an error: % document.ly:8:6: In expression ((eval-string raga)): % document.ly:8:6: Wrong type to apply: parava #(format #t 3) xyz ~a ~% xyz) % This is the end of this example program ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Generating symbols from strings
Paul Hi Jay, You don't need to use string-symbol to do this. #abc will return the value of abc (the string IamJustAText), just like \abc does. I should have made my question clearer. The string in string-symbol is a generated string. I have changed the example program as below to make this clearer. \version 2.18.2 abc = IamJustAText xyz = #(string-symbol (string-append ab c)) #(format #t 1) abc ~a xyz ~a ~% abc xyz) xyz = \abc #(format #t 2) abc ~a xyz ~a ~% abc xyz) ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Generating symbols from strings
Robin The following seems to read out the value of abc: xyz = #(eval (string-symbol abc) (interaction-environment)) Wow, that works! Thanks. I had not noticed interaction-environment when I read the guile manual. I will read through that section this weekend to understand why this works! Thanks again!, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How to get bar lines between measures programmatically
I am using Completion_heads_engraver that break long notes and automatically tie them into the next measure. I have a compound measure, say ((3 4) (2 4) (2 4)). I need the Completion_heads to work not only after 7 quarter notes (which it does), but also after 3 and 5 notes. I also need bar lines at these spots. I modified an engraver I was using to set the completionUnit variable to achieve breaking of long notes and automatically tie them after 3 and 5 notes also. Now, my question is how to get the bar lines to print at these positions. I tried setting measurePosition to zero without success (lines 31-32, commented out now). \version 2.18.2 fs = #(ly:make-moment 3 4) ss = #(ly:make-moment 5 4) ts = #(ly:make-moment 7 4) zs = #(ly:make-moment 0 4) #(define SolfegeEngraver (list (cons 'acknowledgers (list (cons 'note-head-interface (lambda (engraver grob source-engraver) (let* ((context (ly:translator-context engraver)) (tonic-pitch (ly:context-property context 'tonic)) (measure-pos (ly:context-property context 'measurePosition)) (measure-len (ly:context-property context 'measureLength)) (cu (ly:context-property context 'completionUnit)) (ns (ly:context-now context)) (enna (ly:context-property context 'whichBar)) (tonic-name (ly:pitch-notename tonic-pitch)) (delta (- 7 tonic-name)) (solfege-base (circular-list S R G M P D N)) (solfege (take (drop solfege-base delta) 7)) (note-names (apply vector solfege)) ) (if (ly:moment? measure-pos fs) (ly:context-set-property! context 'completionUnit fs) (if (ly:moment? measure-pos ss) (ly:context-set- property! context 'completionUnit ss) (ly:context-set-property! context 'completionUnit ts) )) ; (if (= (ly:moment-main measure-pos) (ly:moment-main fs)) ; (ly:context-set-property! context 'measurePosition zs)) (format #t length ~a position ~a completionUnit ~a now-ns ~a whichbar ~a ~% measure-len measure-pos cu ts enna) (ly:grob-set-property! grob 'note-names (vector S R G M P D N)) ) ) ) \score { \new Staff { \new Voice { \easyHeadsOn \compoundMeter #'((3 4) (2 4) (2 4) ) \relative c' { c d e2 f2 g2 a2 b4 c2 c b4 a g f2 e d4 c} } } \layout { \context { \Voice \consists \SolfegeEngraver \remove Note_heads_engraver \remove Rest_engraver \consists Completion_heads_engraver \consists Completion_rest_engraver } } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Generating symbols from strings
In the following program, I set xyz to the variable abc using scheme string-symbol as well as the usual \abc. Instead of giving the same value for xyz, the first one sets it to string abc and the second sets it to value of abc. What do I need to modify in the assignment of string-symbol to get it to be equivalent to xyz = \abc \version 2.18.2 abc = IamJustAText xyz = #(string-symbol abc) #(format #t 1) abc ~a xyz ~a ~% abc xyz) xyz = \abc #(format #t 2) abc ~a xyz ~a ~% abc xyz) ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to print measure position as each note prints
Paul Paul Morris wrote I'm not sure but what you're trying to do might best be done on the input side. Actually, nevermind since this is before measures/positions have been determined. My next thought is that you may need to create custom engraver, but I'm not even sure that that would allow you to change the measurePosition like you want. There should be a way. If I can get the measurePosition from the glob somehow, it should be possible. Perhaps someone more familiar with the internals can tell us. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Engraver Programming Question
I am not top-posting I tried to build in a way to get the measurePosition and measureLength in a user defined engraver (lines 13 and 14). The idea was to change them as needed. As a first step, I wanted to print the values - I tried putting in a format statement (line 23). The program runs without errors, but does not produce any output. What seems to be the problem with lines 15, 16 (commented out) and 23? \version 2.18.2 measure-len = 1 measure-pos = 1 note-names = Sa #(define SolfegeEngraver (list (cons 'acknowledgers (list (cons 'note-head-interface (lambda (engraver grob source-engraver) (let* ((context (ly:translator-context engraver)) (tonic-pitch (ly:context-property context 'tonic)) (measure-pos (ly:context-property context 'measurePosition)) (measure-len (ly:context-property context 'measureLength)) ; (measure-pos 0) ; (ly:context-set-property! context 'measurePosition measure-pos) (tonic-name (ly:pitch-notename tonic-pitch)) (delta (- 7 tonic-name)) (solfege-base (circular-list S R G M P D N)) (solfege (take (drop solfege-base delta) 7)) (note-names (apply vector solfege))) (format length ~a position ~a note-names ~a ~% measure- len measure-pos note-names) ; (display solfege)(newline) (ly:grob-set-property! grob 'note-names note-names)) ) ) \score { \new Staff { \new Voice { \easyHeadsOn \relative c' { c d e f g a b c } } } \layout { \context { \Voice \consists \SolfegeEngraver } } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Engraver Programming Question
Jan Hi Jay, to output something, you have to display it. The format function returns the formatted string. If you insert #t (true) prior the format string, it will output the result to stdout: (format #t length ~a position ~a note-names ~a ~% measure-len measure-pos note-names) Oh, I should have known. Thanks. An obvious error for you, a giant step forward for me! ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How to print measure position as each note prints
I am not top-posting I am trying to figure out how measure position and measure length work so that I can change them to work properly with compound metres with appropriate bar lines, notes on bars split and tied etc. Two issues I have are: 1) Where to place the function that prints measure position and measure length. By looking at a few snippets, I thought I would put an override on the NoteHead stencil as in the code below. 2) How to retrieve the measure position and length. Again, looking at a few snippets I came up with the code below. As it would be obvious to the experts, the code is not working. It prints nothing. Can someone suggest what I should change? \version 2.18.2 myNoteHeadTry = #(lambda (grob) (let* ( ;; bindings (measure-pos (ly:context-property grob 'measurePosition)) (measure-len (ly:context-property grob 'measureLength)) ) ;; body (format Position ~a Length ~a ~% measure-pos measure-len) (ly:text-interface::print grob) ) ) \score { \compoundMeter #'((5 4) (2 4)) \override NoteHead #`stencil = #myNoteHeadTry \relative c' { c d e f g2 a b c b a4 g f e d c} } \layout { \context { \Voice \remove Note_heads_engraver \consists Completion_heads_engraver}} ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to print measure position as each note prints
Neil Add this to your \layout block: \context { \Score \override PaperColumn.stencil = #ly:paper-column::print } Great! This works nicely. Now I understand better how this thing works internally! You don't set this to anything that the grob will read (see below). (ly:text-interface::print grob) ly:text-interface::print grob looks at the 'text property. Unless the grob supports text-interface (which NoteHead doesn't) you should use the helper function grob-interpret-markup instead which takes the grob and a markup as arguments. Cheers, Neil My point in getting the measurePosition is actually to change it as needed within the measure. I wonder if I can get this info from the grob or some other way. I would like to have bar lines inside the measure and also turn on Completion_heads_engraver. Cheers, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: lilypond-user Digest, Vol 142, Issue 95
Bill, You might be able to write little function that sets the completionUnit to (2 4) once you've finished a (5 4). It would then switch back to (5 4) after finishing the (2 4). You could probably further expand that by having your function respond to a boolean input. That way, you could change the different divisions of a meter after setting your compoundMeter. That is what I am planning to work on. However, I am not sure where I can call this function. I would imagine I need to look at the length of the current measure, look at the current position and decide what should be the completionUnit. I think I would need to call the function in a NoteEvent. But 10 different complex metres? That has to be major fun for listening! When you have something we can hear, send us a link, please! Yes, definitely. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: lilypond-user Digest, Vol 142, Issue 83
bill at wolfcomposer.com bill at wolfcomposer.com writes: Hi, Jay-- Will this get you closer to what you want? \version 2.18.2 fooBar = { s1 s4 \bar | s2 \bar || } music = \relative c' { \compoundMeter #'((5 4) (2 4)) \set completionUnit = #(ly:make- moment 5 4) c4 d e f g2 \set completionUnit = #(ly:make-moment 2 4) a b4 \unset completionUnit c c b a g2 f4 e d c b a g a b } I had not seen the completionUnit possibility. Something based on this concept may work. I do not necessarily want to introduce it into music (since there are too many). I am trying to approach this two ways: First - to figure out how to know the current position and see if it is inside the (5 4) part or the (2 4) part and set the completionUnit appropriately. If I can achieve this, it should also work for shiftedDuration situation. I have searched through the documentation and snippets etc. but have not yet figured out how to do this. Second method is to write a scheme function that would take the music and introduce the ties as needed. This would mean I would have to have a way of counting the notes etc. - probably not the best way, and probably complicated. [I have about 10 different complex metres to deal with] Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: lilypond-user Digest, Vol 142, Issue 80
I am not top-posting Bill, Here is part of the code that shows how I am trying to use compound meter. Like you, I also had to get the in-between bar lines artificially using the silent voice fooBar. Only thing that is not working for me is the Completion_heads_engraver across the in-between bars. For example, the 5th note g2 should have been split and tied. The sixth note a2 is done correctly. \version 2.18.2 fooBar = { s1 s4\bar | s2 \bar || } music = \relative c' {c4 d e f g2 a b4 c c b a g2 f4 e d c b a g a b} \score { \compoundMeter #'((5 4) (2 4) ) \set Timing.beatStructure = #'(5 2 ) \new Voice = theBarLines { \fooBar \fooBar \bar |. } \new Voice \music \shiftDurations #1 #0 {\music} } \layout { \context { \Voice \remove Note_heads_engraver \remove Rest_engraver \consists Completion_heads_engraver \consists Completion_rest_engraver } \context { \Staff %\remove Time_signature_engraver } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
David, Right. Thanks. I know my mistake now - from reading the guile page, I thought eqv? should work for characters. However I should have used string=? since the variable is a string. The display function is a real life saver. Not only is it easy to spot mistakes, it also makes it a good way to experiment new things. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
Paul, can read up on them in the Guile manual). Here's the section on equality (eq? eqv? and equal?): https://www.gnu.org/software/guile/manual/guile.html#Equality I've found the guile manual to be a helpful resource for learning to use Scheme. Yes, I usually refer to the Guile manual although I try it only in Friscobaldi. I found the videos on youtube series http://www.youtube.com/watch? v=byofGyW2L10 [1-5] to be pretty good although his videos 6-7 are a bit confusing. The best help of all seems to be the display command that David showed. I wish they give a little more prominence to it in the manuals and tutorials. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
David Definitely consider trying out the Scheme sandbox. It's much more convenient for learning Scheme than embedding Scheme in ly files. I will try out the sandbox. Yes, it's a lifesaver. I use format more often, because it makes constructing meaningful output a lot easier. You will find--or maybe you already have!--that output to the console can get confusing. For one thing, it's usually out-of-order. Thanks for reminding about format. I did not realise how easy format is to use. I too like it better than display. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Programming Question
I'm not top posting. I am using NoteNames context to print the note names automatically for scales of half notes, quarter notes and eighth notes. I have redefined the NoteNames using override NoteName.Stencil. I need different font sizes for the note names of half, quarter and eighth notes. Currently I have got this working by using three different versions of the myNoteNames function. The only change between them is the fontsize of text. Is there a way to combine the three functions - perhaps have two arguments. I tried this and since the syntax of defining the function and of using it were not clear, I was not able to get it to work. Here is the code: \version 2.18.2 music = \relative c' {c2 d e f g a b c c b a g f e d c} newnames = #`((c . S) (d . R) (e . G) (f . M) (g . P) (a . D) (b . N) ) myNoteNames = #(lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) ) ;; body (ly:grob-set-property! grob 'text new-name) (ly:text-interface::print grob) ) ) myNoteNamesS = #(lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) ) ;; body (ly:grob-set-property! grob 'text (markup #:fontsize -2 new- name)) (ly:text-interface::print grob) ) ) myNoteNamesT = #(lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) ) ;; body (ly:grob-set-property! grob 'text (markup #:fontsize -4 new- name)) (ly:text-interface::print grob) ) ) \new Staff { \new Voice { \music \shiftDurations #1 #0 {\music } \shiftDurations #2 #0 {\music \music } } \context NoteNames { \override NoteName.stencil = #myNoteNames \music \override NoteName.stencil = #myNoteNamesS \shiftDurations #1 #0 {\music } \override NoteName.stencil = #myNoteNamesT \shiftDurations #2 #0 {\music \music } } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
Yay! I tried the cryptic version you suggested, and it works nicely. The syntax does take some time to get used to. When lilypond displays an error, is it possible to know which line of code the error is in? I am using Friscobaldi. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
David, Wow! The power of programming knowledge! Yeah, size can be set based on duration. In my particular case, this is giving some unwanted effects since the duration of all my notes are not the same (unlike in the small example I made up for this post). So I will be using your earlier suggestion. On the other hand, what would be nice is if the NoteName could be changed based on duration. In particular, if the note is a half note, I would like to add a character (say a - or a a) to the note name. This could be more involved probably. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
David: Friscobaldi says: Starting lilypond-windows.exe 2.18.2 [Alam-Ata.ly]... Processing `c:/users/arjuna/appdata/local/temp/frescobaldi- pvt8zv/tmptpz4so/Alam-Ata.ly' Parsing... Interpreting music...[8][16][24][32][40][48][56][64] Preprocessing graphical objects... Interpreting music... warning: cannot find or create `NoteNames' called `' MIDI output to `Alam-Ata.mid'... Interpreting music... Preprocessing graphical objects... Calculating line breaks... Drawing systems... Finding the ideal number of pages... Fitting music on 2 or 3 pages... Drawing systems... Layout output to `Alam-Ata.ps'... Converting to `./Alam-Ata.pdf'... Success: compilation successfully completed Completed successfully in 3.0. I am not able to figure out which line the warning above is coming from. Are the numbers in square brackets the line numbers? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Automatic fixing of note between measures
Sometimes a note in my (generated) music falls on the bar lines. Is there a way to auto fix it by splitting the note as per the measure and joining the two parts with a tie? In the following, the first line shows that there are five quarter notes in the first measure rather than 4. The second line is how I would like it to be auto-resolved. \version 2.18.2 \relative c' {c4 d e f2 g h} \relative c' {c4 d e f~f g h} ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
I am not top-posting David, You are way too good! Is this the way I enter it? For some reason, does not seem to be working - it seems to be ignoring the suffix. If I wanted to display new-name as the program runs, is there a command for that? Thanks Jay \version 2.18.2 music = \relative c' {c2 d e f g a b c c b a g f e d c} newnames = #`((c . S) (d . R) (e . G) (f . M) (g . P) (a . D) (b . N) ) #(define (myNoteNames size) (lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) (cause (event-cause grob)) (duration (ly:prob-property cause 'duration)) (duration-log (ly:duration-log duration)) (suffix (case duration-log ((1) a) ;; half note (else ))) (text (string-append new-name suffix)) ) ;; body (ly:grob-set-property! grob 'text (markup #:fontsize size new- name)) (ly:text-interface::print grob) ) )) \new Staff { \new Voice { \music \shiftDurations #1 #0 {\music } \shiftDurations #2 #0 {\music \music } } \context NoteNames { \override NoteName.stencil = #(myNoteNames 0) \music \override NoteName.stencil = #(myNoteNames -1) \shiftDurations #1 #0 {\music } \override NoteName.stencil = #(myNoteNames -2) \shiftDurations #2 #0 {\music \music } } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Automatic fixing of note between measures
Nice, that works. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Automatic fixing of note between measures
David, That works. Malte also suggested something similar. Is there a reason not to use Completion_heads_engraver all the time or atleast as a default? I am also using a compound metre. Hopefully this will work with that. In one case I have repeating measures of 5/4 + 3/4 + 2/4. I have succeeded in getting the bar lines printed after 5th and 8th quarter notes in a 10/4 time scale by adding a voice with bar lines at those places. May be there is a different method of achieving this effect. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
compoundMeter - how to get lilypond to recognize the bar line in the middle
I am not top-posting I am using a compoundMeter - 5/4 + 2/4. I would like to see a bar line after 5 quarter notes (and after 7 quarter notes). Plus I would like Completion_heads_engraver to recognize the bar line after the 5 quarter notes. I was able to artificially achieve getting the bar lines by adding a silent voice with those bar lines. However I was not able to find anything that would make the fifth note g2 in the following example to be automatically replaced by g4~g4 [tied quarter notes] as happens for the seventh note where a2 is replaced by a4~a4. Also, in the code below, I tried to prevent the time signature from printing - does not seem to work for compoundMeter. Also not sure why I got a couple of extra staff lines, plus how it got the 7/4 meter for the extra staves. \version 2.18.2 fooBar = { s1 s4\bar ! s2 \bar || } music = \relative c' {c4 d e f g2 a b4 c c b a g2 f4 e d c b a g a b} \score { \override Staff.TimeSignature #'stencil = ##f \compoundMeter #'((5 4) (2 4) ) \set Timing.beatStructure = #'(5 2 ) \new Voice = theBarLines { \fooBar \fooBar \bar |. } \new voice \music \shiftDurations #1 #0 {\music} } \layout { \context { \Voice \remove Note_heads_engraver \remove Rest_engraver \consists Completion_heads_engraver \consists Completion_rest_engraver } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
David Fantastic! I can not claim to understand what you have done. The display command is helping - I can see that text has what I need, and why I need to replace the new-name with text in the set property line. Thanks, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Programming Question
I am not top-posting David, I defined a second variable nsiz which is 1, 2 or 3 Tried (case duration-log ((nsiz) a ) (else ))) This condition was never succeeding although I printed out nsiz and duration-log and they were the same. Then I changed it into an if statement - that worked. This is to add a suffix to note name for half notes in normal duration, quarter notes in halved durations, and eighth notes when durations are further halved. It should be obvious from the output that it has worked. Then further, I wanted the suffix to be i if the note was d or b. I tried various if statements and they are all failing for some reason. default-name which is equal to d gives a #f when tested, for example. Not sure what to do to make it work. Here is the code: \version 2.18.2 music = \relative c' {d2 b2 b4 d} % {c4 d2 e f g2 g a4 b c c b a g f e d c} newnames = #`((c . S) (d . R) (e . G) (f . M) (g . P) (a . D) (b . N) ) #(display newnames) #(define (myNoteNames size nsiz) (lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) (cause (event-cause grob)) (duration (ly:prob-property cause 'duration)) (duration-log (ly:duration-log duration)) (suffix (case duration-log ((1) (if (= nsiz 1) (if (or (eqv? new-name R) (eqv? default-name b)) i a) )) ;; half note ((2) (if (= nsiz 2) a )) ;; quarter note ((3) (if (= nsiz 3) a )) ;; eighth note (else ))) (text (string-append new-name suffix)) ) (display default-name) (display (eq? default-name d)) (display duration-log) (display size) (display nsiz) (display text) (newline);; body (ly:grob-set-property! grob 'text (markup #:fontsize size text)) (ly:text-interface::print grob) ) )) \new Staff { \new Voice { \music \shiftDurations #1 #0 {\music } \shiftDurations #2 #0 {\music \music } } \context NoteNames { \override NoteName.stencil = #(myNoteNames 0 1) \music \override NoteName.stencil = #(myNoteNames -1 2) \shiftDurations #1 #0 {\music } \override NoteName.stencil = #(myNoteNames -2 3) \shiftDurations #2 #0 {\music \music } } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Can NoteNames in higher octaves be changed?
I'm not top posting. David, How I wish I could understand how you do what you do! It all looks like magic to me. Is there a place that shows how to use all these functions? I tried to adapt what you showed to my system. So far, all attempts have resulted in syntax error or other error, mostly because I do not know what the commands actually do. Here is what I have - it prints the NoteNames as S R G M P D and N as defined in the newnames variable. For the range of notes from low G to high G, it prints P D N S R G M P D N S R G M P. What I would like to see printed is: p d n S R G M P D N s̊ r̊ g̊ m̊ p̊ [where the higher octave notes have a dot on top]. Jay \version 2.18.2 music = {g2 a b c d e f g a b c d e f g} newnames = #`((c . S) (d . R) (e . G) (f . M) (g . P) (a . D) (b . N)) myNoteNames = #(lambda (grob) (let* ( ;; bindings (default-name (ly:grob-property grob 'text)) (new-name (assoc-get default-name newnames)) ) ;; body (ly:grob-set-property! grob 'text new-name) (ly:text-interface::print grob) ) ) \new Staff { \relative c' \music \context NoteNames { \set printOctaveNames = ##t \override NoteName.stencil = #myNoteNames \music } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Can NoteNames in higher octaves be changed?
David, That worked. I have now defined a 2.5 octave range that covers most of my music. I will try to learn the scm slowly - I should say it is a bit confusing with all the different levels of parenthesis. Thanks, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How do you tell Lilypond not to jump strings when sliding?
I'm not top posting. When you give lilypond a piece of music, it automatically generates the music and guitar tabs for it. When there are glissandos in the music, lilypod does show the slides automatically. However, many times, it shows slides from one string to another, rather than choosing frets on the same string. Is there a way to force it to restrict slides to a single string? The following code shows an example. The second measure shows the automatically generated lilypod slides that go from the first string to the second string. (This can not be played) In the third measure, I have manually forced the notes to all be on the second string. I need a way to do this automatically. Also, I tried to avoid open strings by setting restrainOpenStrings to true. It does not seem to work. \version 2.18.2 musica = \relative c' {e2 e} musicb = \relative c' {e2 e8\glissando (d16\glissando e16)} musicc = \relative c' {e2 e8\2\glissando (d16\glissando e16\2)} \score { \new StaffGroup \new Staff {\musica \musicb \musicc} \new TabStaff { \set TabStaff.restrainOpenStrings = ##t \tabFullNotation \musica \musicb \musicc} } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How do you tell Lilypond not to jump strings when sliding?
Frederico, Yay! I added \set TabStaff.minimumFret = #1 and now it works! Who would have thought that minimumFret is related to restrainOpenStrings! Thanks, Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How do you tell Lilypond not to jump strings when sliding?
I'm not top posting. I spoke too soon. Setting the minimumFret does fix the restrainOpenStrings issue, but not the jumping strings during slide issue as seen in the code below. There should be some way to tell lilypond not to jump strings during slides. \version 2.18.2 musica = \relative c'' {g8\glissando e8 g8\glissando (e16\glissando g16)} musicb = \relative c' {e2 e8\glissando (d16\glissando e16)} musicc = \relative c' {e2 e8\2\glissando (d16\glissando e16\2)} \score { \new StaffGroup \new Staff {\musica \musicb \musicc \musica \musicb \musicc} \new TabStaff { \set TabStaff.restrainOpenStrings = ##t \tabFullNotation \musica \musicb \musicc % setting minimumFret to a number, say #1, prevents the jumping strings during sliding for the second measure (as seen in the fourth measure) but % introduces the jump problem for the 1st measure (as seen in the 3rd measure) \set TabStaff.minimumFret = #1 \musica \musicb \musicc} } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How do you tell Lilypond not to jump strings when sliding?
Phil Burfitt phil.burfitt at talktalk.net writes: Jay, You'll need to indicate string numbers. They can be hidden with \omit StringNumber if you do not want the circled numbers to appear. Btw, guitar music is usually written an octave higher than it sounds. You should use \clef treble_8 in the \new Staff section. Hope that helps. Phil. Phil, Thanks. I was hoping that there was a way to tell lilypond not to jump between strings when sliding - that is logical and makes sense. You are saying that I have to specify the StringNumber, which is what I wanted to avoid. I think this situation does not make sense for such an advanced software as lilypond. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Can NoteNames in higher octaves be changed?
I'm not top posting. NoteNames will print the higher (and lower) octave names with printOctaveNames set to true. It prints them as c', d', c, d, etc. My question is: Is it possible to have the higher octaves print using a different character, say C D E F etc rather than c', d', e', f'. Here is a piece of code that I found that shows how it currently works: \version 2.18.2 scale = \relative c' { a4 b c d e4 f g,, a } \new Staff { \scale \context NoteNames { \set printOctaveNames = ##f \scale } R1 \scale \context NoteNames { \set printOctaveNames = ##t \scale } } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How to get bar lines in lyrics
Here is the link to the not-working example: http://goo.gl/n54RZB -- the snippet is called bar-lines-lyric-only . The link to the source is: http://goo.gl/7kO7Gf ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get bar lines in lyrics
Jay Vara Jay at DilJun.com writes: Here is the link to the not-working example: http://goo.gl/n54RZB -- the snippet is called bar-lines-lyric-only . The link to the source is: http://goo.gl/7kO7Gf This was a case of my not understanding how to use snippets found on the web. Like David suspected, it did not work because the lilypond code was from an old version. I used the convert.ly in friscobaldi which changed the code to be compatible with version 2.18.2, and now it works fine. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to get bar lines in lyrics
Thanks Pierre, that works. ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Can NoteNames in higher octaves be changed?
Hello Simon, I tried using the code you sent. The output is still the same. It appears that your code allows me to input capital names for higher octave notes. Is that right? What I wanted is for automatically printing capital names - using NoteNames context. With NoteNames, you just enter the music and lyric is automatically produced as the note names. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How do I define an Lilypond/Scheme alist as cons of two a lists?
David, Sorry, I did not know that I was using the regression code. This is my first week with Lilypond. Hopefully, I will learn enough to produce some nice music. Jay ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
How do I define an Lilypond/Scheme alist as cons of two a lists?
I have pitch names defined as a alist in Lilypond as below and it works fine. \version 2.18.2 pitchname = #`( (saa . , (ly:make-pitch -1 0 NATURAL)) (raa . , (ly:make-pitch -1 1 FLAT)) (sa . , (ly:make-pitch -1 0 NATURAL)) (ri . , (ly:make-pitch -1 1 FLAT)) (ga . , (ly:make-pitch -1 2 NATURAL)) ) #(ly:parser-set-note-names parser pitchname) musicA = \relative sa' { sa4 ri ga sa ri ga sa ri ga ri saa ga ri sa ga raa } \score {\musicA} I would like to define the variable pitchname as sum/join/append/cons of two a lists, as below: firstpart = #`( (saa . , (ly:make-pitch -1 0 NATURAL)) (raa . , (ly:make-pitch -1 1 FLAT)) ) secondpart = #'( (sa . , (ly:make-pitch -1 0 NATURAL)) (ri . , (ly:make-pitch -1 1 FLAT)) (ga . , (ly:make-pitch -1 2 NATURAL)) ) and combine the two, say: pitchname = (cons #firstpart #secondpart) OR pitchname = (append #firstpart #secondpart) The last statement combining the two parts is not working. Can someone tell me what I am doing wrong here? ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user