Underlining fingering instructions without loosing positioning
I'm trying to have underlined fingering instructions in Lilypond v. 2.12.3. - On a button accordion this would mean that the "helper rows" (I don't know the English term) should be used instead of the main rows. I've seen different posts about this, but in every case, the solution has had to do with using \markup. I've been using something like: ^\markup{\finger \underline "3"} This approach works fine in simple cases, but if the music contains slurs, the spacing between the slur and the fingering instructions vary. This doesn't look very good, and it makes the fingering harder to read. The example below shows the problem: c'4-1( d-2 e-3 f-4 g-5) c,4^\markup{\underline \finger "1"}( d-2 e-3 f^\markup{\underline \finger "4"} g-5) The \finger apparently ensures the correct font, but is there some command to make it "behave" or position itself like a fingering instruction? Regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Solving espressivo problem
Dear list I am trying to solve this problem about espressivos that stretches over four beats. I have tried many versions but not seems to solve it The c1 and the b4 c2 b4 bars work as I hoped for. the b2 c2 bar and the a2~ a2 does not give the wished for results. Can anybody help? * \version "2.24.3" stuff = \relative { \time 4/4 r4 b'4 a2~\< <>\! a2\> <>\! b4 4( c1\espressivo) b2\< <>\!\> c2\! c1\espressivo b4\< c2\!\> b4\! \bar "|" } \score { << \new Staff \stuff >> \layout { \context { \Staff } } } * thanks Morten
Re: Solving espressivo problem
mor...@borchorst.eu skrev den 2024-05-11 11:40: Dear list I am trying to solve this problem about espressivos that stretches over four beats. I have tried many versions but not seems to solve it The c1 and the b4 c2 b4 bars work as I hoped for. the b2 c2 bar and the a2~ a2 does not give the wished for results. Can anybody help? * \version "2.24.3" stuff = \relative { \time 4/4 r4 b'4 a2~\< <>\! a2\> <>\! b4 4( c1\espressivo) b2\< <>\!\> c2\! c1\espressivo b4\< c2\!\> b4\! \bar "|" } \score { << \new Staff \stuff >> \layout { \context { \Staff } } } * thanks Morten Now with image attached :/
Re: Solving espressivo problem
Thank you all ... I learned a lot fromt your answers Now I just have to implement a solution. Greetings Morten Lukas-Fabian Moser skrev den 2024-05-11 16:32: Here’s one approach: %%% SNIPPET BEGINS \version "2.25.11" esp = \markup \lower #1 \scale #'(1.375 . 1) \musicglyph #"scripts.espr" stuff = \relative { \time 4/4 r4 b'4 a2-\tweak self-alignment-X #-1.25 _\esp ~ a2 b4 4( c1)-\tweak self-alignment-X #-0.5 _\esp b2-\tweak self-alignment-X #-1.125 _\esp d2 c1-\tweak self-alignment-X #-0.5 _\esp \bar "|" } \score { << \new Staff \stuff }% %% SNIPPET ENDS Or equivalently, saving some keystrokes: %%% SNIPPET BEGINS \version "2.25.9" esp = _\markup \lower #1 \scale #'(1.375 . 1) \musicglyph #"scripts.espr" shift = \tweak self-alignment-X \etc stuff = \relative { \time 4/4 r4 b'4 a2\shift -1.25 \esp ~ a2 b4 4( c1)\shift -0.5 \esp b2\shift -1.125 \esp d2 c1\shift -0.5 \esp \bar "|" } \score { << \new Staff \stuff >> }% %% SNIPPET ENDS Lukas
Re: timing, lyrics, chords, melody
Grammostola Rosea wrote: Hi, Trying to make my first lilypond song and put let it be on score but I can't make the timing of the lyrics fit with the melody... : \version "2.11.53" melody = \relative c' { \clef treble \key c \major \time 4/4 \partial 4 g8 a c4 c d a c c d e f f f e e d d2 e4 e f e e d2 e4 d4 c2 } harmony = \chordmode { r8 r c2 g a:min f4:maj7f:6 c2 g f c } text = \lyrics {When I find my-self in times of trou-ble, Mother Mary comes to me, Speaking words of wishdom let it be. } \score { << \new ChordNames { \harmony } \new Staff {\melody } \new Lyrics { \text } >> \layout { } \midi { } } Try to have a look at the documentation concerning lyrics and vocal music: http://lilypond.org/doc/v2.10/Documentation/user/lilypond/Vocal-music The Lyrics should be associated with a "Voice": \new Staff { \new Voice = "melodyVoice" {\melody} } \new Lyrics \lyricsto "melodyVoice" \text Furthermore you should indicate with a "--" where the words in the lyrics should be broken, when they span several notes: When I find my -- self in ... Hope this helps, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Merging stems with three voices on one staff
I have three parallel voices on one staff. The stems of two of the voices point in opposite directions and the last one is shifted. Which looks a bit cluttered with respect to both stems and beams. Is the some way to merge the stem and beam of the middle note with one of the other voices? I've attached a small example. Regards, Morten \version "2.10.33" \header { title = "Test" } global = { \clef "G_8" \key c \major \time 4/4 \tempo 4=60 } melody = \relative a { a8 g b a g b } tmelody = {\transpose a c' \melody} tglobal = {\transpose a c' \global} musik = { \context StaffGroup << \context Staff = tenor << \tglobal \context Voice = "ftenor" {\voiceOne \tmelody} \\ \context Voice = "atenor" {\voiceThree {\transpose c g, \tmelody}} \\ \context Voice = "ttenor" {\voiceTwo {\transpose c c, \tmelody}} >> >> } \score { \musik \layout {} } ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: "between-system-space" command using OpenOffice
Mats Bengtsson wrote: You are completely right, in that the spacing between systems is handled within LaTeX (or HTML or texinfo) if you use lilypond-book. I'm setting a book in latex - how do I tell lilypond-book to make the between-system-space bigger? I just use the \lilypondfile{myfile.ly} command for music inclusion. - I couldn't find anything under the lilypond-book documentation. Thanks, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Connecting bar lines in ChoirStaff
Is it possible to connect the bar lines of different staffs on the very end of a piece using ChoirStaff? Regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Connecting bar lines in ChoirStaff
Thanks, after some experiments it worked just fine! But now I've become greedy... is it possible to identify the last bar on every line? What I would like to do is to have a connected bar line between Staffs at the end of each line. With many staffs it's sometimes easy to get confused when going to a new line. Regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
How to change clef style
I'm trying to typeset a book in different styles; modern and ancient looking. By including the same file in all the pieces I've almost succeeded in making the ancient style, with something like: \override NoteHead #'style = #'neomensural in a layout block But I cannot figure out how to change the clef symbols. I just need to change the symbols to something ancient looking. It shouldn't be a direct clef change, I would like the notes to stay on the same lines in the staff, as if it was still a G- or F-clef. Can this be done in some clever way? Regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: How to change clef style
From that section it's clear, how I can insert different kinds of ancient clefs, but I already have a large collection of pieces, where I've used \clef "G", \clef "G_8" and \clef "F". I would like to change the look of them without having to edit all the documents. Since they all include the same file, I hoped for a way to globally change the look of the clefs. Maybe it's clear from that section as well, but then I just don't get it... Sorry! Morten Mats Bengtsson wrote: See the section on "Ancient clefs" in the manual. Note that you can click on every example in the on-line manual to see the corresponding .ly code. /Mats Morten Lemvigh wrote: I'm trying to typeset a book in different styles; modern and ancient looking. By including the same file in all the pieces I've almost succeeded in making the ancient style, with something like: \override NoteHead #'style = #'neomensural in a layout block But I cannot figure out how to change the clef symbols. I just need to change the symbols to something ancient looking. It shouldn't be a direct clef change, I would like the notes to stay on the same lines in the staff, as if it was still a G- or F-clef. Can this be done in some clever way? Regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Positioning of lyrics
I'm setting a vocal piece for SATB. There is an intro with SA and then T and B join them in the verse. In the verse, I would like the lyrics to be positioned between S and A and between T and B. But when I include the intro I cannot get the lyrics to stay between T and B, they jump up below A. Here is a minimal example of what I get: http://www.lemvigh.org/test.png And here is what I wrote to get it: http://www.lemvigh.org/test.ly What should I do in order to get the lyrics to stay between T and B? Thanks, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Positioning of lyrics
Thanks, it makes sence! But when I tried to apply it to the larger piece, i got this: programming error: Moment is not increasing. Aborting interpretation. I have a problem creating a minimal example, where the error occurs. But I will try to make something as minimal as possible. The error occurs, when the lyrics of one part covers all notes off that part, then the next part, and the rest of the piece is not printed. If I uncomment the lyrics or delete the last word, there is no problem...??? Morten Mats Bengtsson wrote: Your line \context Lyrics = C \lyricsto tenorVerse \textVerseA happens already from the beginning of the piece, whereas the line \new Lyrics = "C" {s1} which the former line refers to, happens (time-wise) after the intro. The following version of the \score block, works as you would expect: \score { << \new ChoirStaff { %%% INTRO %%% {<< \new Lyrics = "A" {s1} \new Staff = "sopranos" {\new Voice = "sIntro" { << \sIntro >>}} \new Lyrics = "B" {s1} \new Staff = "altos" {\new Voice = "aIntro" { << \aIntro >>}} >>} %%% VERSE %%% {<< \context Staff = "sopranos" {\new Voice = "sopranoVerse" {<< \sVerse >>}} \context Staff = "altos" {\new Voice = "altoVerse" { << \aVerse >> }} \context Staff = "tenors" {\new Voice = "tenorVerse" { << \tVerse >> }} \new Lyrics = "C" {s1} \context Staff = "basses" {\new Voice = "bassVerse" { << \bVerse >> }} \context Lyrics = C \lyricsto tenorVerse \textVerseA >>}} \context Lyrics = A \lyricsto sIntro \textIntro \context Lyrics = B \lyricsto aIntro \aIntroText \context Lyrics = B \lyricsto sopranoVerse \textVerseA >> \layout {} } Actually, since the Voice context tenorVerse which you refer to, has already been setup, you could also simplify the verse part of your score block to: %%% VERSE %%% {<< \context Staff = "sopranos" {\new Voice = "sopranoVerse" {<< \sVerse >>}} \context Staff = "altos" {\new Voice = "altoVerse" { << \aVerse >> }} \context Staff = "tenors" {\new Voice = "tenorVerse" { << \tVerse >> }} \context Lyrics = C \lyricsto tenorVerse \textVerseA \context Staff = "basses" {\new Voice = "bassVerse" { << \bVerse >> }} >>} You can do the same also with the other lyrics lines, but for the "A" Lyrics context, you will then need to set alignAboveContext, as is shown in appendix "D.4.3 SATB with aligned contexts" of the manual. /Mats Quoting Morten Lemvigh <[EMAIL PROTECTED]>: I'm setting a vocal piece for SATB. There is an intro with SA and then T and B join them in the verse. In the verse, I would like the lyrics to be positioned between S and A and between T and B. But when I include the intro I cannot get the lyrics to stay between T and B, they jump up below A. Here is a minimal example of what I get: http://www.lemvigh.org/test.png And here is what I wrote to get it: http://www.lemvigh.org/test.ly What should I do in order to get the lyrics to stay between T and B? Thanks, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Positioning of lyrics
OK, now I've isolated the problem When I have two blocks following each other, and the lyrics of the first block extends to the last note of the block, then I get the message: programming error: Moment is not increasing. Aborting interpretation. If I uncomment the last word of the lyrics, there is no problem. Here is what I get (with and without the last word in the lyrics): http://www.lemvigh.org/test2a.png http://www.lemvigh.org/test2b.png and here is the source: http://www.lemvigh.org/test2.ly /Morten Mats Bengtsson wrote: Your line \context Lyrics = C \lyricsto tenorVerse \textVerseA happens already from the beginning of the piece, whereas the line \new Lyrics = "C" {s1} which the former line refers to, happens (time-wise) after the intro. The following version of the \score block, works as you would expect: \score { << \new ChoirStaff { %%% INTRO %%% {<< \new Lyrics = "A" {s1} \new Staff = "sopranos" {\new Voice = "sIntro" { << \sIntro >>}} \new Lyrics = "B" {s1} \new Staff = "altos" {\new Voice = "aIntro" { << \aIntro >>}} >>} %%% VERSE %%% {<< \context Staff = "sopranos" {\new Voice = "sopranoVerse" {<< \sVerse >>}} \context Staff = "altos" {\new Voice = "altoVerse" { << \aVerse >> }} \context Staff = "tenors" {\new Voice = "tenorVerse" { << \tVerse >> }} \new Lyrics = "C" {s1} \context Staff = "basses" {\new Voice = "bassVerse" { << \bVerse >> }} \context Lyrics = C \lyricsto tenorVerse \textVerseA >>}} \context Lyrics = A \lyricsto sIntro \textIntro \context Lyrics = B \lyricsto aIntro \aIntroText \context Lyrics = B \lyricsto sopranoVerse \textVerseA >> \layout {} } Actually, since the Voice context tenorVerse which you refer to, has already been setup, you could also simplify the verse part of your score block to: %%% VERSE %%% {<< \context Staff = "sopranos" {\new Voice = "sopranoVerse" {<< \sVerse >>}} \context Staff = "altos" {\new Voice = "altoVerse" { << \aVerse >> }} \context Staff = "tenors" {\new Voice = "tenorVerse" { << \tVerse >> }} \context Lyrics = C \lyricsto tenorVerse \textVerseA \context Staff = "basses" {\new Voice = "bassVerse" { << \bVerse >> }} >>} You can do the same also with the other lyrics lines, but for the "A" Lyrics context, you will then need to set alignAboveContext, as is shown in appendix "D.4.3 SATB with aligned contexts" of the manual. /Mats Quoting Morten Lemvigh <[EMAIL PROTECTED]>: I'm setting a vocal piece for SATB. There is an intro with SA and then T and B join them in the verse. In the verse, I would like the lyrics to be positioned between S and A and between T and B. But when I include the intro I cannot get the lyrics to stay between T and B, they jump up below A. Here is a minimal example of what I get: http://www.lemvigh.org/test.png And here is what I wrote to get it: http://www.lemvigh.org/test.ly What should I do in order to get the lyrics to stay between T and B? Thanks, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
One MIDI file pr voice
Is there an easy way to produce a MIDI file per voice? Or should I do it with several runs of Lilypond, commenting the other voiced out? Regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
lilypond-book under winXP
I'm having some problems running lilypond-book under WinXP. I get the same error no matter what I do. Even if I type in the lilypond-book-example from the Users Guide. The errormsg I get is written below. I just upgraded to version 2.8 but the problem was there in version 2.6 as well. If anyone could give me a hint, as to where I should start looking for the problem, I would be very thankfull! /Morten And now the errorMsg: Reading bog.lytex... Running latex...Traceback (most recent call last): File "C:\Programmer\LilyPond\usr\bin\lilypond-book.py", line 1762, in ? main () File "C:\Programmer\LilyPond\usr\bin\lilypond-book.py", line 1716, in main chunks = do_file (file) File "C:\Programmer\LilyPond\usr\bin\lilypond-book.py", line 1611, in do_file set_default_options (source) File "C:\Programmer\LilyPond\usr\bin\lilypond-book.py", line 759, in set_defau lt_options textwidth = get_latex_textwidth (source) File "C:\Programmer\LilyPond\usr\bin\lilypond-book.py", line 1416, in get_late x_textwidth ly.system ('latex %s' % tmpfile, be_verbose=global_options.verbose) File "C:\Programmer\LilyPond\usr\share\lilypond\current\python\lilylib.py", li ne 95, in system stderr=stdout_setting) File "C:\Programmer\LilyPond\usr\lib\python2.4\subprocess.py", line 542, in __ init__ errread, errwrite) File "C:\Programmer\LilyPond\usr\lib\python2.4\subprocess.py", line 899, in _e xecute_child errpipe_read, errpipe_write = os.pipe() AttributeError: 'module' object has no attribute 'pipe' ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Rearranging \alternatives
I'm trying to get at piece to have alternative endings using: \repeat volta 5 { ... } \alternative { {...} {...} } But instead of having the first part repeatet 4 times I would like to have the repeat pattern to be [1,3,4,5] and [2] - the 1st, 3td, 4th and 5th verse are the same and the 2nd is special. Is that possible to do??? Thanks in advance Morten Lemvigh ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
German chords with default base note
How do I print German chord names with \germanChords but keep the standard notation for the base note, so I get fx A7/c# instead of A7/cis??? Thanks, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
line-width in lilypond-book
I'm trying to set a songbook using lilypond-book with lilypond 2.10.2 and latex with the geometry package. By some reason lilypond doesn't guess the right linewidth, so I have tried to specify it by: \lilypondfile[line-width=10\cm]{infile.ly} but that doesn't affect the linewidth. But if I set line-width in the layout block in the .ly-file, then it works nicely. I would like the scaling to take place in the latex document, so if anyone could tell me, why it works in the one place but not in the other, I would be thankful! Best regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: German chords with default base note
After setting only: \set chordRootNamer = #(chord-name->german-markup #t) I got almost what I wanted, the names are correct, and I get # instead of is, so now I only need to make the base tone lowercase, so the final result would look like: A7/c# and not A7/C# I get that by setting: \set chordNoteNamer = #note-name->german-markup But then the #'s are replaced by is' Can it be done without defining a whole new function, perhaps something like majorSevenSymbol for accidentals? I would very much like to avoid new functions, since I'm not very much into the ways of Lilypond. regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Real-world usage of Lilypond
You might want to contact Wilco van den Tol. As far as I remember he worked out a project like this a few years ago. Greetings Morten Christ van Willegen skrev: ...although we all are in 'the real world' (or at least think we are :-) ) Recently, I was attending a speech by one of the leading people being busy with compiling a new book of church songs for The Netherlands (or at least the Calvinist/Lutheran part of it). When the speech was finished I asked him if it was appropriate to point him to software that does music engraving. He said that it was and took out paper and a pen. When I dropped the name Lilypond he put away paper and pen. And told me that they were already looking into using Lilypond... So, here's a serious example of the usage of Lilypond in the real world. I was wondering if perhaps 'we' were able to help him, by: - Engraving songs for publishing, making them 'as good as possible'; - Extending Lilypond to (more easily?) accomodate engraving of church music. Two examples that I can think of are: Setting rests at the end of a system, and making music centered and not left aligned; - Any other advice/techniques/additions/modifications we can think of. Are there any people out there that would be willing to help make this possible? Perhaps some Lilypond funding could be possible (it is, after all, a commercial undertaking), and at least it can be shown that Lilypond is ready for world usage. Christ van Willegen ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Single notes among chord names
I'm writing a lead sheet with melody and chord names above. In one measure I want to have single notes in the base instead of chords, but I cannot figure out how to display this among the chord names. What I would like is something like: | G | g f# e | B | I have only been able to display bass notes as part of an inversion, but I don't want the chord - only the bass note. Can this be done in some way? As a side question: what is this phenomenon called in English? It's hard to search for, when you don't know the name... What I currently have is the following: chordNames = \chordmode { ... g2. | g fis e | b2.:7 | ... } And I include it in the peace using: \new FretBoards { \chordNames } \new ChordNames { \chordNames } Thanks on beforehand! Morten ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Skipping syllables from lyrics
Hi, I have some choir pieces, where all voices are singing the same verses, but in some places one voice is omitting one or a few words. Is there some way of skipping syllables from the lyrics from within the voice context. Like entering "null notes" that would be bound to lyrics but cause them to not be rendered? For example in the music for the tenor voice I would like to enter "skip 2 syllables from the lyrics at this point". My current alternative is to create lyric snippets for all the consecutive parts and then glue them together for each voice. But with just a few skipped words in a couple of voices it quickly becomes unmanageable. Alternatively I could have complete copies of each verse for each voice, but making corrections to that is not very attractive. Any ideas for a better approach are highly appreciated. Best regards, Morten
Music generated by function confuses relative pitch
Hi, I am trying to create a set of functions to help me set up songs with divisi lyrics. When I generate a midi file with the unfolded music, I would like it to have the different rhythms in the different voltas. I get some unexpected results with regards to pitches. I have tried to create a small example, the exhibits some of the same challenges as what I am facing with my divisi helpers: \version "2.24.1" double = #(define-music-function (music)(ly:music?) (let ((notes (ly:music-property music 'elements))) (make-music 'SequentialMusic 'elements (list (make-music 'SequentialMusic 'elements notes) (make-music 'SequentialMusic 'elements notes) \relative c' { \double {e4 e} } There are several things that confuses me with the output of this: 1. The first note is an octave higher than I would expect (it is e'') 2. The second note is an octave higher than the first. The third and fourth are the same as the first and second. 3. If I remove one of the "make-music" from the list, both remaining notes get the same pitch at the expected e'. 4. If I change the music expression by lowering the last note an octave: \double {e4 e,} Then I will get all four notes on the same pitch (e'). It seems the musical construct I generate is confusing the relative function. There are clearly some fundamentals regarding generating music from functions that I have missed. If someone could help shed some light on why I get the output I do, it would be highly appreciated. Best regards, Morten
Re: Music generated by function confuses relative pitch
Hi Jean, Thank you so much for that clear and thorough explanation. I was so caught up in my functional transformations, that I didn't even stop to think if mutation could be at play. I sprinkled a handful of deep-copies over my functions and voila! - and thanks again! I really appreciate you taking the time to help me understand and explain these details. Best regards, Morten On Thu, Feb 22, 2024 at 11:38 PM Jean Abou Samra wrote: > Hi Morten, > > Le jeudi 22 février 2024 à 23:00 +0100, Morten Lemvigh a écrit : > > \version "2.24.1" > > > > double = > > #(define-music-function (music)(ly:music?) > >(let ((notes (ly:music-property music 'elements))) > > (make-music 'SequentialMusic > > 'elements > > (list > > (make-music 'SequentialMusic > > 'elements notes) > > (make-music 'SequentialMusic > > 'elements notes) > > > > \relative c' { > > \double {e4 e} > > } > > > Several things are wrong here. > > First, although you are unwrapping `music`, you are not copying the > individual > elements of `notes`. They end up duplicated in the output. This should > never > happen, because music objects are mutable. \relative is in fact a good > example > of this, but perhaps a simpler one is \scaleDurations: try > > \scaleDurations 1/2 \double { e'1 1 } > > and you will see that the whole notes are scaled by 1/4 instead of 1/2. > The reason > is that calling [note1] and [note2] the two note objects, you end up with > > [note1] [note2] [note1] [note2] > > and when \scaleDurations goes through the music and scales it, since > [note1] > and [note2] both appear twice, they get scaled twice. > > That's the reason you should always copy music with ly:music-deep-copy > or an equivalent if you need it to appear in several places. > > In your example > > \relative c' { > \double {e4 e} > } > > what happens is the following: \relative changes the first e4 into an > absolute > e'4, to match the octave of c' . Then the second e is changed to e'4 as > well, > to have the same octave as the first. Then the third e is processed, but > it's > actually the same object as the first e4, which was mutated into e'4, so > this > tells \relative to go an octave higher, and that e'4 is mutated a second > time > into an e''4. And finally, the fourth e is processed, it's the same as the > second > e which was turned into e', which goes an octave up, so it becomes e'''. > And that's why the end result is e''4 e''' e''4 e'''. > > So this is already a better version: > > double = > #(define-music-function (music)(ly:music?) >(make-music 'SequentialMusic >'elements (list (ly:music-deep-copy music) >(ly:music-deep-copy music > > or more simply put: > > double = > #(define-music-function (music)(ly:music?) >#{ $music $music #}) > > but in fact this is still not correct because \relative is a somewhat > special beast. The problem is that > > \relative c' { > \double {e'4 e} > } > > now unfolds to > > \relative c' { > { e'4 e e'4 e } > } > > where the third e'4 goes an octave up compared to the second, but you > don't want that, you want it to be the same as the first e'4. For that > case, there is a special macro called make-relative. It's used like this: > > \version "2.24.1" > > double = > #(define-music-function (music) (ly:music?) >(make-relative (music) music > #{ $music $music #})) > > > Best, > Jean > >
Composing music functions
Hi, I'm trying to create some tools for setting choir pieces. I have run against a problem where I have a music function that needs the result of another music function. That other function uses a Lilypond code block, so it takes both parser and location. For reasons I don't understand, I cannot get this to work. Lilypond gives me a: Wrong type to apply: #> I have tried to create a small toy example to show what I want to achieve: rest-around = #(define-music-function (parser location music ) (ly:music?) #{ r4 $music r4 #}) restful-choir = #(define-music-function (parser location music) (ly:music?) (let ((rest-around (rest-around parser location music))) #{ << \new Voice { \voiceOne \transpose c g $rest-framed } \new Voice { \voiceTwo $rest-framed } >> #})) music = { c' d' e' } \score { \new Staff { \restful-choir \music } } I have run into this problem a couple of times, the current problem I'm trying to solve is: I have a list of music an I am trying to map each item of the list with a function that creates a staff with the music. Afterwards they should be combined as 'SimultaneousMusic. I would like to use Lilypond code blocks where I think it is clearer than the Scheme counterpart. Is there something obvious I am doing wrong, or am I perhaps completely off on this approach...? Best regards, Morten ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Composing music functions
Hi, Thank you for your answer - seems so much good is coming :-). Lilypond is just amazing! - and also a lesson to myself about checking renames in example code :-) Best regards, Morten On Sun, Mar 12, 2017 at 11:30 PM, Thomas Morley wrote: > 2017-03-12 22:46 GMT+01:00 Morten Lemvigh : > > Hi, > > > > I'm trying to create some tools for setting choir pieces. I have run > against > > a problem where I have a music function that needs the result of another > > music function. That other function uses a Lilypond code block, so it > takes > > both parser and location. For reasons I don't understand, I cannot get > this > > to work. Lilypond gives me a: > > > > Wrong type to apply: #> > > > > > > I have tried to create a small toy example to show what I want to > achieve: > > > > rest-around = #(define-music-function (parser location music ) > (ly:music?) > > #{ r4 $music r4 #}) > > > > restful-choir = #(define-music-function (parser location music) > (ly:music?) > > (let ((rest-around (rest-around parser location music))) > >#{ > > << > >\new Voice { \voiceOne \transpose c g $rest-framed } > > rest-framed is not defined see terminal-output: > > error: GUILE signaled an error for the expression beginning here >\new Voice { \voiceOne \transpose c g $ > rest-framed } > Unbound variable: rest-framed > > > >\new Voice { \voiceTwo $rest-framed } > > >> > >#})) > > > > > > music = { c' d' e' } > > > > \score { > > \new Staff { \restful-choir \music } > > } > > > > I have run into this problem a couple of times, the current problem I'm > > trying to solve is: I have a list of music an I am trying to map each > item > > of the list with a function that creates a staff with the music. > Afterwards > > they should be combined as 'SimultaneousMusic. I would like to use > Lilypond > > code blocks where I think it is clearer than the Scheme counterpart. > > > > Is there something obvious I am doing wrong, > > You did not post your lily-version ;) > > > or am I perhaps completely off > > on this approach...? > > > > Best regards, > > Morten > > This works for newer devel-versions: > > \version "2.19.56" > > rest-around = #(define-music-function (music ) (ly:music?) > #{ r4 $music r4 #}) > > restful-choir = #(define-music-function (music) (ly:music?) > (let ((rest-framed (rest-around music))) >#{ > << >\new Voice { \voiceOne \transpose c g $rest-framed } >\new Voice { \voiceTwo $rest-framed } > >> >#})) > > > music = { c' d' e' } > > \score { > \new Staff { \restful-choir \music } > } > > > Cheers, > Harm > ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Dynamically outputting \books
Hi, I am trying to create a procedure to create rehearsal midi files for each voice of a choir piece. In order to do that I need to be able to dynamically create \book blocks (one for each voice). Is that possible? I have tried to have a music function output it like: rehearsalMidi = #(define-music-function (parser location) () #{ \book { .. } #}) but that gives me an error: music function cannot return # Is there some way to dynamically create book blocks? Thanks, Morten ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Get name of music object
Hi, Music objects are created with a name and some properties: make-music name music-properties I know how to get the properties from a music object - but how about the name? I cannot figure out how to get the name from a music object. It is difficult to search for since the word "name" pops up everywhere. The only thing I found was a function to search by name: extract-named-music. Best regards, Morten
Rhythmic pattern in MIDI
Hi, I have a small piece with a rhythmic pattern like this: \tempo \markup { \rhythm { 8[ 8] } = \rhythm { \tuplet 3/2 { 8(8) 8 } } } Does anybody know of a way I can perform the same mapping on the generated MIDI file? I would like to generate a rehearsal file for the piece. It should follow the rhythmic pattern, but I would like to avoid typing the music in twice. Best regards, Morten
Creating score with unfolded repeats in scheme
Hi, I am experimenting with a system to create choir rehearsal midi files. A part of that is to unfold repeats. I have a function that accepts a score and creates a new score. The steps are: 1. Extract the music from the score 2. Unfold the repeats 3. Make a new score For some reason only the first note of the score is repeated and I get a "programming error: Moment is not increasing. Aborting interpretation." When I try to display-scheme-music of the unfolded music it looks like everything is there, but it is not included in the final score. I have tried to create a minimal example that reproduces the issue. It is pasted below. So the question is: what have I misunderstood? :-) Best regards, Morten \version "2.24.2" choirScore = \score { \new Staff { \relative c' { \repeat volta 2 { c d e f } } } } make-rehearsal = #(define-scheme-function (the-score) (ly:score?) (ly:make-score (unfold-repeats-fully (ly:score-music the-score new-score = #(make-rehearsal choirScore) \new-score
Re: Creating score with unfolded repeats in scheme
Hi Hans, Thank you for the pointer - that sounds a lot like what I am trying to achieve. I will certainly take a closer look at that. Best regards, Morten On Mon, Sep 9, 2024 at 11:49 PM Hans Aikema wrote: > > > On 9 Sep 2024, at 23:10, Morten Lemvigh wrote: > > Hi, > > I am experimenting with a system to create choir rehearsal midi files. A > part of that is to unfold repeats. I have a function that accepts a score > and creates a new score. The steps are: > 1. Extract the music from the score > 2. Unfold the repeats > 3. Make a new score > > For some reason only the first note of the score is repeated and I get a > "programming error: Moment is not increasing. Aborting interpretation." > > When I try to display-scheme-music of the unfolded music it looks like > everything is there, but it is not included in the final score. > I have tried to create a minimal example that reproduces the issue. It is > pasted below. > > So the question is: what have I misunderstood? :-) > > Best regards, > Morten > > \version "2.24.2" > > choirScore = \score { > \new Staff { > \relative c' { > \repeat volta 2 { > c d e f > } > } > } > } > > make-rehearsal = > #(define-scheme-function > (the-score) > (ly:score?) > (ly:make-score (unfold-repeats-fully (ly:score-music the-score > > new-score = #(make-rehearsal choirScore) > \new-score > > > What I found very useful in my case for the rehearsal tracks is the > rehearsalMidi function from the openlilylib gridly grit-templates include, > which I’ve been using stand-alone in my own (historically grown and > improved) choir arrangements. > > https://github.com/openlilylib/snippets/blob/master/ly/gridly/grid-templates.ily > > As an inspiration here’s how I’ve organised things in my system (which no > doubt could be improved): > > A folder per song > Variables for each of the voices’ notes (sopMusic, altMusic etc) and each > of the voices lyrics (sopWords, altWords etc) each defined in a file named > after the voice (soprano.ily, alto.ily etc) > > The main composition file bringing it all together .ly > ``` > \version "2.19.3" > > \header { > … > } > > \paper { > first-page-number = 1 > } > > global = { > % defines tempo, initial key, time signature > } > > \include "soprano.ily" > \include "alto.ily" > \include "tenor.ily" > \include "basso.ily" > \include "../temlates/SATB.ily" > ``` > > Include-files to setup a staff per voice in a templates folder > e.g. for Soprano (soprano.ily): > ``` > \version "2.22.0" > soprano_Staff = { > \new Staff = soprano \with { > instrumentName = "Soprano" > shortInstrumentName = "S" > }<< > \new Voice = "soprano" { \clef "treble" \global \sopMusic } > \tag #'lyrics {\new Lyrics \with {alignBelowContext=sopStaff} > \lyricsto soprano \sopWords} > >> > } > ``` > > Include-file for an entire arrangement layout that includes the relevant > per-voice templates and then goes on to defined the overall music as the > allMusic variable > ``` > allMusic = { > << > \metronome > \new ChoirStaff << > \soprano_Staff > \alto_Staff > \tenor_Staff > \basso_Staff > >> % end of ChoirStaff > >> % end of full system > } > ``` > > Which is then used both to create a full SATB-score sheet music as per > ``` > \book { > \bookOutputSuffix "lilypond" > \score { > \removeWithTag #'metronome > \allMusic > > \layout {} > } > } > ``` > > A tutti-track with all music at regular volume: > ``` > \book { > \bookOutputSuffix "tutti" > \score { > \unfoldRepeats { \removeWithTag #'lyrics \allMusic } > \midi { > \context { > \Score > dynamicAbsoluteVolumeFunction = #hatikwaDynamics > } > } > } > } > ``` > > And per-voice highlighted tracks (using the rehearsal-midi function, > which, among others, unfolds the music and lowers the volume of all voices > except the voice given as its argument) e.g. for the soprano group: > ``` > \rehearsalMidi { \removeWithTag #'lyrics \allMusic } "soprano" > ``` > > > >
Re: Creating score with unfolded repeats in scheme
Hi David, Thank you for the swift and precise response. That was exactly it. When I am in search of new functionality, I usually search this page for keywords: https://lilypond.org/doc/v2.23/Documentation/internals/scheme-functions That was how I found the ly:make-score. Is there some way of deducing if a function is intended to be called directly or is only an internal utility function? Best regards, Morten On Mon, Sep 9, 2024 at 11:28 PM David Kastrup wrote: > Morten Lemvigh writes: > > > So the question is: what have I misunderstood? :-) > > > > Best regards, > > Morten > > > > \version "2.24.2" > > > > choirScore = \score { > > \new Staff { > > \relative c' { > > \repeat volta 2 { > > c d e f > > } > > } > > } > > } > > > > make-rehearsal = > > #(define-scheme-function > > (the-score) > > (ly:score?) > > (ly:make-score (unfold-repeats-fully (ly:score-music the-score > > > > new-score = #(make-rehearsal choirScore) > > \new-score > > If you define the function with define-scheme-function instead of > #(define ...), why not call it as > > new-score = \make-rehearsal \choirScore > > ? That's just a detail. The main problem is that ly:make-score is an > internal function that does not do the full required job of creating a > score from unprepared music. > > To get the full preparation necessary, use scorify-music instead of > ly:make-music . It uses ly:make-music internally but does other > required things. > > -- > David Kastrup >
Re: it's all up to you users
Graham Percival skrev: I haven't been a doc writer for a year; I'm a doc manager. And today I'm doing nothing but giving my thesis presentation every hour in preparation for tomorrow's defense, which gives me 30-40 minutes to write emails. If a one-hour email now saves the doc team 15 minutes per week for the rest of 2008, that's a bargain. Cheers, - Graham The best wishes for tomorrow ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Having a lot of text under one note
Hi all on the list. This is my first posting to this list, so pls forgive me if I'm asking silly questions. We are aiming at getting some modern churchmusic to print, and have come to stop by a problem concerning one bar. According to the manuscript the bar consists of a whole note with a lot of text under. The following example shows what we have accompliched till now. Only to see that part of the text falls over the clef and to the left of the system. When one of these bars is in the middle of a system, apparently the right part of the text will be missing. Could you tell me how to extend the measure to give room for all of the text? psalm23.ly: \version "2.2.0" \header { dedication = "Dedication" title = "Psalm 23 [Nieuwe Bijbelvertaling]" subtitle = "gezet voor anglican Chant" subsubtitle = "subsubtitle" ... } sopMusic = \notes \relative c'' { \key e \major ... soprano music ... } sopWords = \lyrics { } altoMusic = \notes \relative c' { \key e \major ... some alto music ... e1 fis2 e dis1( dis) \bar "||" cis dis \break cis b ... more alto music ... } altoWords =\lyrics { ... \override LyricText #'self-alignment-X = #-0.50 "en leidt mij langs veilige paden tot" \override LyricText #'self-alignment-X = #0 eer "van zijn" naam. ... } ... more music and text ... \score { \notes \context StaffGroup << \context Lyrics = sopranos { s1 } \context Staff = women << \context Voice = sopranos { \voiceOne \sopMusic } \context Voice = altos { \voiceTwo \altoMusic } >> \context Lyrics = altos { s1 } \context Lyrics = tenors { s1 } \context Staff = men << \clef bass \context Voice = tenors { \voiceOne \tenorMusic } \context Voice = basses { \voiceTwo \bassMusic } >> \context Lyrics = basses { s1 } \context Lyrics = sopranos \lyricsto sopranos \sopWords \context Lyrics = altos \lyricsto altos \altoWords \context Lyrics = tenors \lyricsto tenors \tenorWords \context Lyrics = basses \lyricsto basses \bassWords >> \paper { \context { % a little smaller so lyrics can be closer to the staff. \StaffContext minimumVerticalExtent = #'(-3 . 3) } } } thks Morten Borchorst ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Difference in in output between LP and lilypond-book
Hi I am trying to put together some LP files with LP-book running LP (2.2.6) gives a very satisfying result. When running LP-book everything seems to go smoothly except when converting the .dvi to .pdf (dvipdf). I get the following messages: font feta11 not found font feta-number4 not found font cmbxti8 not found and the resulting .pdf lacks all the heads in the music. Does anybody know where the error is, and what i can do to correct it? Greetings Morten Borchorst ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Difference in in output between LP and lilypond-book
Graham Percival wrote: On 11-Feb-05, at 4:44 PM, eva & Morten Borchorst wrote: running LP (2.2.6) gives a very satisfying result. When running LP-book everything seems to go smoothly except when converting the .dvi to .pdf (dvipdf). I get the following messages: There's some problem with your installation of lilypond and its fonts. You didn't mention what operating system you're running. I'm running debian Sarge with LP in the Pedro Kröger version. Also have the 2.4 installed, but my files are for 2.2, and I would like to have them working first. Please re-run any installation program(s) you used and try again. You may also wish to upgrade to a more recent version (2.4.something). You mean I should try to uninstall all LP packages and install them again? Cheers, - Graham Greetings and thanks Morten Borchorst ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Difference in in output between LP and lilypond-book
Graham Percival wrote: On 12-Feb-05, at 3:24 PM, eva & Morten Borchorst wrote: Graham Percival wrote: On 11-Feb-05, at 4:44 PM, eva & Morten Borchorst wrote: running LP (2.2.6) gives a very satisfying result. When running LP-book everything seems to go smoothly except when converting the .dvi to .pdf (dvipdf). I get the following messages: There's some problem with your installation of lilypond and its fonts. You didn't mention what operating system you're running. I'm running debian Sarge with LP in the Pedro Kröger version. Also have the 2.4 installed, but my files are for 2.2, and I would like to have them working first. Sorry, I don't understand. What version of lilypond do you have currently installed? (what does "lilypond --version" give you, and what does "dpkg -l lilypond*" give you?) It says lilypond 2.2.6-2.1 dpkg -l lilypond-snapshot (which is the name Pedro gives the 2.4 series) says: lilypond-snapshot 2.4.2-1 From what I understand of the debian packages, you shouldn't be able to have lily 2.4 and lily 2.2 installed at the same time. If you do, try uninstalling both of them and then installing one of them. If you have both installed (without doing some fancier unix stuff), I'm not surprised that Lilypond gets confused with font issues. I expect Pedros way of naming the series differently should not influence the functioning Cheers, - Graham greetings Morten ___ lilypond-user mailing list lilypond-user@gnu.org http://lists.gnu.org/mailman/listinfo/lilypond-user
Scheme attempt gives 'unknown escape string' error - any hints appreciated
Hi all Im writing a small sceme function to be able to create examples of guitar fingerings for various scales. basically i create a music function "fretsc" to be called for example as \fretsc "(6 1) (6 3) (5 0)"to indicate the position and sequence of notes in a scale. However I get an "unknown escape string" for \fret while compiling. Anyone have an idea what Im doing wrong? Here is the example code if you comment out the last line you can see the kind of fret diagram I am working on. \version "2.14.0" fretsc = #(define-music-function (parser location s1 ) (string?) #{ \markup{\override #'(fret-diagram-details . ( (finger-code . in-dot) (number-type . arabic) (label-dir . -1) (orientation . landscape) (dot-radius . 0.5) (fret-count . 5) (top-fret-thickness . 5) (barre-type . straight) (xo-padding . 0.3) )) { \fret-diagram-verbose #'( $s1 ) } } #}) ddd = \markup{\override #'(fret-diagram-details . ( (finger-code . in-dot) (number-type . arabic) (label-dir . -1) (orientation . landscape) (dot-radius . 0.5) (fret-count . 5) (top-fret-thickness . 5) (barre-type . straight) (xo-padding . 0.3) )) { \fret-diagram-verbose #'( (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 5) (place-fret 1 4 6) ) } } \score { \new Staff {\relative c' { a'^\ddd b c d }} } \fretsc "(6 3 1) (5 3 2)" ... and here are the errors: Processing `/Users/mjc/Desktop/all music/noder/snippets/fret.ly' Parsing... :2:0: error: syntax error, unexpected \markup \markup{\override #(quote (fret-diagram-details (finger-code . in-dot) (number-type . arabic) (label-dir . -1) (orientation . landscape) (dot-radius . 0.5) (fret-count . 5) (top-fret-thickness . 5) (barre-type . straight) (xo-padding . 0.3))) { :3:8: error: unknown escaped string: `\fret' \fret-diagram-verbose #(quote (lilyvartmpbg)) /Users/mjc/Desktop/all music/noder/snippets/fret.ly:47:0: error: errors found, ignoring music expression \fretsc "(6 3 1) (5 3 2)" success: Compilation successfully completed ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Scheme attempt gives 'unknown escape string' error - any hints appreciated
Hi all Im writing a small sceme function to be able to create examples of guitar fingerings for various scales. basically i create a music function "fretsc" to be called for example as \fretsc "(6 1) (6 3) (5 0)"to indicate the position and sequence of notes in a scale. However I get an "unknown escape string" for \fret while compiling. Anyone have an idea what Im doing wrong? Here is the example code if you comment out the last line you can see the kind of fret diagram I am working on. Best regards Morten Jagd Christensen \version "2.14.0" fretsc = #(define-music-function (parser location s1 ) (string?) #{ \markup{\override #'(fret-diagram-details . ( (finger-code . in-dot) (number-type . arabic) (label-dir . -1) (orientation . landscape) (dot-radius . 0.5) (fret-count . 5) (top-fret-thickness . 5) (barre-type . straight) (xo-padding . 0.3) )) { \fret-diagram-verbose #'( $s1 ) } } #}) ddd = \markup{\override #'(fret-diagram-details . ( (finger-code . in-dot) (number-type . arabic) (label-dir . -1) (orientation . landscape) (dot-radius . 0.5) (fret-count . 5) (top-fret-thickness . 5) (barre-type . straight) (xo-padding . 0.3) )) { \fret-diagram-verbose #'( (place-fret 5 3 1) (place-fret 4 5 2) (place-fret 3 5 3) (place-fret 2 5 4) (place-fret 1 3 5) (place-fret 1 4 6) ) } } \score { \new Staff {\relative c' { a'^\ddd b c d }} } \fretsc "(6 3 1) (5 3 2)" ... and here are the errors: Processing `/Users/mjc/Desktop/all music/noder/snippets/fret.ly' Parsing... :2:0: error: syntax error, unexpected \markup \markup{\override #(quote (fret-diagram-details (finger-code . in-dot) (number-type . arabic) (label-dir . -1) (orientation . landscape) (dot-radius . 0.5) (fret-count . 5) (top-fret-thickness . 5) (barre-type . straight) (xo-padding . 0.3))) { :3:8: error: unknown escaped string: `\fret' \fret-diagram-verbose #(quote (lilyvartmpbg)) /Users/mjc/Desktop/all music/noder/snippets/fret.ly:47:0: error: errors found, ignoring music expression \fretsc "(6 3 1) (5 3 2)" success: Compilation successfully completed ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Keyboard chord figure in scheme
Hello all I'm trying to make a scheme function that generates a keyboard with black and white dots for showing specific chord layouts The code below compiles and produces the keyboard figure I then call a function (make-dot key) which works fine. What I really want is (make-dot-list '(1 5 8)) which should produce a black dot on c, a white dot on ees and a black dot on g (for a C major chord). I suspect that somehow only the last empty-stencil is returned but have been unable to solve my problem. Does anyone have a suggestion how to solve this? Best regards Morten (newbie scheme programmer) %--SNIPPET BELOW \version "2.14.2" #(define KEY-POS-LIST '((1 . 1) (2 . 1.5) (3 . 2) (4 . 2.5) (5 . 3) (6 . 4) (7 . 4.5) (8 . 5) (9 . 5.5) (10 . 6) (11 . 6.5) (12 . 7) (13 . 8))) #(define (black-key num ) (if (member num '(2 4 7 9 11 14 16 19)) #f #t)) #(define (key-to-pos key ypos) (cons (- (cdr (assv key KEY-POS-LIST)) 0.5) ypos)) #(define (make-dot key) (if (black-key key) (ly:stencil-translate (make-circle-stencil 0.0 0.5 #f) (key-to-pos key 1) ) (ly:stencil-in-color (ly:stencil-translate (make-circle-stencil 0.0 0.5 #f) (key-to-pos key 3)) 1 1 1 ))) #(define (make-dot-list l1) (make-dot (car l1)) (if (null? (cdr l1)) empty-stencil (make-dot-list (cdr l1 #(define (make-white-keys lt width height) (begin (ly:stencil-add (make-line-stencil lt 0 0 width 0) (make-line-stencil lt width 0 width height) (make-line-stencil lt width height 0 height ) (make-line-stencil lt 0 height 0 0 ) (make-line-stencil lt 1 0 1 height ) (make-line-stencil lt 2 0 2 height ) (make-line-stencil lt 3 0 3 height ) (make-line-stencil lt 4 0 4 height ) (make-line-stencil lt 5 0 5 height ) (make-line-stencil lt 6 0 6 height ) (make-line-stencil lt 7 0 7 height ) (make-line-stencil lt 8 0 8 height ) (make-line-stencil lt 9 0 9 height ) (make-line-stencil lt 10 0 10 height ) (make-line-stencil lt 11 0 11 height #(define (make-black-keys lt width height) (begin (ly:stencil-add (make-line-stencil lt 1 height 1 (/ height 2.5 )) (make-line-stencil lt 2 height 2 (/ height 2.5 )) (make-line-stencil lt 4 height 4 (/ height 2.5 )) (make-line-stencil lt 5 height 5 (/ height 2.5 )) (make-line-stencil lt 6 height 6 (/ height 2.5 )) (make-line-stencil lt 8 height 8 (/ height 2.5 )) (make-line-stencil lt 9 height 9 (/ height 2.5 )) (make-line-stencil lt 11 height 11 (/ height 2.5 ) #(define (keys-from-list-two l1 l2) (let* ((width 12) (height 6) (lt 0.15) (lttwo 0.7)) (begin (ly:stencil-add (make-white-keys lt width height) (make-black-keys lttwo width height) (make-dot 7) (make-dot 12) (make-dot-list '(1 2 3)) #(define-markup-command (keystwo layout props arg1) (list?) (keys-from-list-two '() '() )) dmajor=\markup\keystwo #'(1) \relative c' { c4 c^\dmajor c } ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user
Re: Keyboard chord figure in scheme
Hi Carl Thanks for the hint - I guess it wasn't clear to me when and where ly:stencil-add was needed. Now the code works, although there still are som FIXME's. For example the black keys are generated by thick lines, but unfortunately they have rounded caps. But I have submitted my code to the snippet repository any way, so hopefully others can benefit from your help too. Cheers /Morten On 18/1/12 2:55 AM, Carl Sorensen wrote: On 1/17/12 2:30 PM, "Morten Jagd Christensen" wrote: Hello all I'm trying to make a scheme function that generates a keyboard with black and white dots for showing specific chord layouts The code below compiles and produces the keyboard figure I then call a function (make-dot key) which works fine. What I really want is (make-dot-list '(1 5 8)) which should produce a black dot on c, a white dot on ees and a black dot on g (for a C major chord). I suspect that somehow only the last empty-stencil is returned but have been unable to solve my problem. Does anyone have a suggestion how to solve this? First of all, congratulations on this attempt. It's very good. You are correct. You are only returning the empty stencil. You need the following: #(define (make-dot-list l1) (if (null? l1) empty-stencil (ly:stencil-add (make-dot (car l1) (make-dot-list (cdr l1 This way, you are adding all the stencils. Previously, you were not doing anything with the make-dot stencil. It was getting created, then thrown away. Good luck! Carl ___ lilypond-user mailing list lilypond-user@gnu.org https://lists.gnu.org/mailman/listinfo/lilypond-user