Re: define function with glissando
Thank you. That is working great for a "slide into" function. How I'm trying to create a "slide out of" function. I thought using /afterGrace woiuld be the ticket. But I find that it works until I hide then grace notes. Then it has the following bar check message. C:/Users/waltn/AppData/Local/Temp/frescobaldi-nrao5slu/tmp4c_xa8e2/document.ly:46:27: warning: barcheck failed at: 1/4 \sloB 4 d2. | \version "2.24.4" \layout { \context { \Score \override Glissando.minimum-length = #3 \override Glissando.springs-and-rods = #ly:spanner::set-spacing-rods \override Glissando.thickness = #2 } } % function to profide slide into one or more notes % sNotes: hidden notes to control amount of slant % eNotes: target notes sli = #(define-music-function (sNotes eNotes) (ly:music? ly:music?) #{ { \once \hideNotes \grace {$sNotes \glissando} \unHideNotes $eNotes } #}) % function to profide slide out of one or more notes % sNotes: notes to slide out of % eNotes: hidden target notes to control amount of slant sloA = #(define-music-function (sNotes eNotes) (ly:music? ly:music?) #{ { % this works but shows the notes I'd like to hide \afterGrace {$sNotes \glissando} $eNotes } #}) % This is the desired code but the hideNotes seems % to throwing the bar check off. sloB = #(define-music-function (sNotes eNotes) (ly:music? ly:music?) #{ { \afterGrace {$sNotes \glissando} \hideNotes $eNotes \unHideNotes } #}) \relative c'' { \sli 4 1 | \sloA 4 d2. | \sloB 4 d2. | }
Re: Automatic beaming behaviour
On Sun, 2024-11-24 at 16:57 +0100, David Kastrup wrote: > David Sumbler writes: > > > What I don't understand is why I need both the 8th-note and 16th- > > note > > entries. The name "beamExceptions" implies that one only needs to > > specify the exceptional beaming - but the 16th note version is > > already > > the default. Is it the case that if any exception is described, > > then > > one has to describe all cases? > > No. > > > If so, then the name beamExceptions is a bit misleading. > > > > Also I don't quite understand the underlying rules which mean (I > > assume) that defining the 16th-note beaming as above, covers bars > > such > > as | [8 16 16] [8 8] | and | [16 8 16] [8. 16] |. > > > > Essentially the beam exceptions tell LilyPond that if a rhythmic > structure has all the note ending points of a beaming exception, the > exception applies. I don't know how LilyPond decides that a given > exception "applies even more", namely prioritizes them. But there is > something it does here. I also note Timothy's useful comments re the Notation Reference, so thank you both. I'm still a little confused, though,,, Is there any way to get Lilypond to distinguish between notes and rests? For instance, if I use the suggested form: \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] | 16[ 16 16 16] 16[ 16 16 16] } then that achieves what I originally asked for, which is for the beaming in a bar of quaver notes to be [c8 c8 c8 c8]. This is fine for the piece I am currently setting. But suppose I had some bars with rests - for instance | c8 c c r | r c c c |. With the new beamingExceptions setting, I find that these are now beamed as | [c c c] r | and | r [c c c] |. I would perhaps, though, want them to appear as | [c c] c r | and | r c c[ c] | (i.e. without a beam crossing the middle of the bar). Is there a way to get this result with automatic beaming and still keep my new [c c c c] beaming, or would it have to be done with manual beams? David Sumbler
Re: Automatic beaming behaviour
On 24/11/2024 13:50, David Sumbler wrote: \version "2.24.3" \language "english" \new Staff \relative { \time 2/4 \set Timing.baseMoment = #(ly:make-moment 1/4) \set Timing.beatStructure = 1,1 \set Timing.beamExceptions = #'() \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] } c''8 c16 c c c c8 c8 c c c } Add a second beamExceptions rule for 16th notes \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] | \repeat unfold 2 { 16[ 16 16 16] } } -- Timothy Lanfear, Bristol, UK.
Re: Automatic beaming behaviour
David Sumbler writes: > I am setting a piece in 2/4 time. Lilypond's default beaming pattern > is to break beams at the mid-bar point, which is what one would > generally expect. However, I would like it to use a single beam for > the whole bar if, and only if, the bar consists of 4 quavers/half- > notes. You mean, 4 quavers/eighth-notes. > Of course I can easily achieve this using square brackets in the > relevant places. But it would be nice to automate this behaviour. > Having spent a lot of time reading the relevant parts of the Notation > Reference and various snippets, I still can't achieve what I want. One > of my attempts is shown below. > > I want the first bar to have 2 beams (one for each half of the bar) but > for the 2nd bar to have a single beam. > > How can this be done? > > \version "2.24.3" > \language "english" > > \new Staff \relative { > \time 2/4 > \set Timing.baseMoment = #(ly:make-moment 1/4) > \set Timing.beatStructure = 1,1 > \set Timing.beamExceptions = #'() > \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] } > c''8 c16 c c c c8 > c8 c c c > } You could try something like \version "2.24.3" \language "english" \new Staff \relative { \time 2/4 \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] | 16[ 16 16 16] 16[ 16 16 16] } c''8 16 16 16 16 8 8 8 16 16 8 8 8 8 16 16 16 16 8 8 8 8 8 8 8 } Extra lines may be needed to cater for tuplets if you have any. -- David Kastrup
Re: define function with glissando
On 24/11/2024 06:27, Walt North wrote: I am working on a function to give myself a "slide into". Although I am not entirely sure why, the solution seems to be to include the \glissando within the scope of the \grace command. slideC = #(define-music-function (sNotes eNotes) (ly:music? ly:music?) #{ { \once \hideNotes \grace { $sNotes \glissando } $eNotes } #}) -- Timothy Lanfear, Bristol, UK.
Re: Combining split-out instruments
Hi Phil, Below is a modified snippet showing some things I would do in your situation. (Note there are other ways of accomplishing the same things!) 1. I’ve defined custom contexts: a MySambaStaff context for shared characteristics, and individual contexts (TamborinStaff, PulseStaff, BothStaff) for characteristics specific to each type of staff. This allows easier code maintenance and reuse, and (IMO) makes the code a lot easier to read. 2. I used a GrandStaff to get the span barlines. 3. I tried using \partCombine for the BothStaff music, but it threw an error. Don’t have time to chase it down, but that’s almost certainly what you’ll want/need to use here, in order to have notes and rests “merged” correctly. Hope this helps! Kieren. %%% SNIPPET BEGINS \version "2.19.21" #(ly:set-option 'point-and-click #f) #(set-global-staff-size 24) \header { title = "Bass and Tam" } tamborim_notes = \drummode { cbr cb r cbr cb r r cb r cb cbr r r } tamborim_words = \lyricmode { one two three four one "2" "3" } pulse_notes = \drummode { r r r r bdr r r r r r r bdr r r } pulse_words = \lyricmode { } #(define mysamba '( (cowbell default #f 0) (bassdrum default #f -1) ) ) \layout { ragged-right = ##f indent = 1\in \context { \DrumStaff \name MySambaStaff \consists Pitch_squash_engraver drumStyleTable = #(alist->hash-table mysamba) \hide Stem \override Rest.font-size = #-2 } \context { \MySambaStaff \name TamborimStaff instrumentName = "Tamborim" \override StaffSymbol.line-count = #1 \override StaffSymbol.line-positions = #'( 0 ) \override StaffSymbol.staff-space = #1 \override Rest.staff-position = #0 } \context { \MySambaStaff \name PulseStaff instrumentName = "Pulse" \override StaffSymbol.line-count = #1 \override StaffSymbol.line-positions = #'( -1 ) \override StaffSymbol.staff-space = #1 \override Clef.Y-offset = #-0.5 \override Rest.staff-position = #-1 } \context { \MySambaStaff \name BothStaff \consists Merge_rests_engraver instrumentName = "Both" \override InstrumentName.padding = #0.4 \override StaffSymbol.line-count = #2 \override StaffSymbol.line-positions = #'( 0 -1 ) \override StaffSymbol.staff-space = #3 \override NoteColumn.force-hshift = #0 \override Rest.staff-position = #-0.5 } \context { \GrandStaff \remove System_start_delimiter_engraver \accepts TamborimStaff \accepts PulseStaff \accepts BothStaff \omit TimeSignature \override InstrumentName.padding = #1 \override InstrumentName.self-alignment-X = #RIGHT } } \score { \new GrandStaff << \new TamborimStaff { \repeat volta 3 \new DrumVoice { \voiceOne \tamborim_notes } \addlyrics \tamborim_words } \new BothStaff { \repeat volta 3 << \new DrumVoice { \voiceOne \pulse_notes } \\ \new DrumVoice { \voiceTwo \tamborim_notes } >> } \new PulseStaff { \repeat volta 3 \new DrumVoice { \voiceOne \pulse_notes } \addlyrics \pulse_words } >> } %%% SNIPPET ENDS > On Nov 23, 2024, at 2:37 PM, Philip Harris via LilyPond user discussion > wrote: > > Hi > > I'm trying to create a teaching page for samba "grooves" for non-music > readers !! > > Each groove is typically about 4 measures long and each instrument plays up > to 4 notes per measure (the tune is made up from multiple repetitions of > these grooves!) > > I want to use the same note definitions in multiple scores in the .ly file so > I can have each instrument separately (possibly with a mnemonic) > > and also together on one stave - so you can more easily see where the the > notes are played in relation to the other instruments - I hope my attached > .pdf file gives an insight > > I have created quite a big example as I am still learning! > > In it I use bassdrum (bd) for my "pulse" and cowbell (cb) for the tamborim - > as I cannot find these actual instruments in the midi voices > > Of the back of my example I have a few questions... > > 1) how do I define a set of notes for each of two instruments such that I can > use them alone and with eachother (I don't want to see rests and notes on the > same vertical line) > > 2) How do I make the rests smaller (#'mensural does not seem to work) > > 3) How do I extend the bar lines so they span all the scores (like the > initial one does!) > > 4) Do I have to use other instruments to simulate samba instruments (it would > be nice to be able to generate midi and play the combined and individual parts > > I have other questions - but I suspect I might be going about this in the > wrong way - so feel free to point out how I
Automatic beaming behaviour
I am setting a piece in 2/4 time. Lilypond's default beaming pattern is to break beams at the mid-bar point, which is what one would generally expect. However, I would like it to use a single beam for the whole bar if, and only if, the bar consists of 4 quavers/half- notes. Of course I can easily achieve this using square brackets in the relevant places. But it would be nice to automate this behaviour. Having spent a lot of time reading the relevant parts of the Notation Reference and various snippets, I still can't achieve what I want. One of my attempts is shown below. I want the first bar to have 2 beams (one for each half of the bar) but for the 2nd bar to have a single beam. How can this be done? \version "2.24.3" \language "english" \new Staff \relative { \time 2/4 \set Timing.baseMoment = #(ly:make-moment 1/4) \set Timing.beatStructure = 1,1 \set Timing.beamExceptions = #'() \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] } c''8 c16 c c c c8 c8 c c c } David
Re: Automatic beaming behaviour
On Sun, 2024-11-24 at 15:25 +0100, David Kastrup wrote: > David Sumbler writes: > > > I am setting a piece in 2/4 time. Lilypond's default beaming > > pattern > > is to break beams at the mid-bar point, which is what one would > > generally expect. However, I would like it to use a single beam > > for > > the whole bar if, and only if, the bar consists of 4 quavers/half- > > notes. > > You mean, 4 quavers/eighth-notes. Yes, I do, sorry! > > Of course I can easily achieve this using square brackets in the > > relevant places. But it would be nice to automate this behaviour. > > Having spent a lot of time reading the relevant parts of the > > Notation > > Reference and various snippets, I still can't achieve what I want. > > One > > of my attempts is shown below. > > > > I want the first bar to have 2 beams (one for each half of the bar) > > but > > for the 2nd bar to have a single beam. > > > > How can this be done? > > > > \version "2.24.3" > > \language "english" > > > > \new Staff \relative { > > \time 2/4 > > \set Timing.baseMoment = #(ly:make-moment 1/4) > > \set Timing.beatStructure = 1,1 > > \set Timing.beamExceptions = #'() > > \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] } > > c''8 c16 c c c c8 > > c8 c c c > > } Thank you both for your suggestions, which amount to using: \set Timing.beamExceptions = \beamExceptions { 8[ 8 8 8] | 16[ 16 16 16] 16[ 16 16 16] } and imply that the baseMoment and beatStructure lines are not required, probably since they are the default values in 2/4 time. What I don't understand is why I need both the 8th-note and 16th-note entries. The name "beamExceptions" implies that one only needs to specify the exceptional beaming - but the 16th note version is already the default. Is it the case that if any exception is described, then one has to describe all cases? If so, then the name beamExceptions is a bit misleading. Also I don't quite understand the underlying rules which mean (I assume) that defining the 16th-note beaming as above, covers bars such as | [8 16 16] [8 8] | and | [16 8 16] [8. 16] |. David
Re: define function with glissando
On 24/11/2024 15:34, Walt North wrote: Thank you. That is working great for a "slide into" function. How I'm trying to create a "slide out of" function. I thought using /afterGrace woiuld be the ticket. In this case, you need to group the glissando as part of the first argument of the afterGrace function, and \hideNotes as part of the 2nd argument. sloB = #(define-music-function (sNotes eNotes) (ly:music? ly:music?) #{ { \afterGrace { $sNotes \glissando } { \once \hideNotes $eNotes } } #}) -- Timothy Lanfear, Bristol, UK.
Re: Automatic beaming behaviour
David Sumbler writes: > What I don't understand is why I need both the 8th-note and 16th-note > entries. The name "beamExceptions" implies that one only needs to > specify the exceptional beaming - but the 16th note version is already > the default. Is it the case that if any exception is described, then > one has to describe all cases? No. > If so, then the name beamExceptions is a bit misleading. > > Also I don't quite understand the underlying rules which mean (I > assume) that defining the 16th-note beaming as above, covers bars such > as | [8 16 16] [8 8] | and | [16 8 16] [8. 16] |. > Essentially the beam exceptions tell LilyPond that if a rhythmic structure has all the note ending points of a beaming exception, the exception applies. I don't know how LilyPond decides that a given exception "applies even more", namely prioritizes them. But there is something it does here. -- David Kastrup
Re: Automatic beaming behaviour
What I don't understand is why I need both the 8th-note and 16th-note entries. The name "beamExceptions" implies that one only needs to specify the exceptional beaming - but the 16th note version is already the default. Is it the case that if /any/ exception is described, then one has to describe all cases? If so, then the name beamExceptions is a bit misleading. Also I don't quite understand the underlying rules which mean (I assume) that defining the 16th-note beaming as above, covers bars such as | [8 16 16] [8 8] | and | [16 8 16] [8. 16] |. The information is in the notation reference manual although it does need careful reading to spot it all. You can find this note about the need to specify beamExceptions completely: *Note:*A|beamExceptions|value must be/complete/exceptions list. That is, every exception that should be applied must be included in the setting. It is not possible to add, remove, or change only one of the exceptions. While this may seem cumbersome, it means that the current beaming settings need not be known in order to specify a new beaming pattern. And in the section "How automatic beaming works", if a beam ending rule is defined in|beamExceptions|for a longer beam type, use it to determine the valid places where beams may end Applying this to your case, without an explicit rule for 16th notes, the rule for 8th notes (beam the whole bar) is used for 16th notes as well. -- Timothy Lanfear, Bristol, UK.