define function with glissando

2024-11-23 Thread Walt North

I am working on a function to give myself a "slide into".

I've been able to get something to work that accepts a single pitch but 
with two or more pitches.  I tried using both ly:pitch and ly:music 
(though I'm not sure what the ly:music type really represents).


See attached code.

It has something to do with not being able to attach the glissando 
event.  I can see with a test that the glissando is attaching to after 
the second parameter.


In the example below the desired result is in the second measure (done 
with inline code). The goal is to hide this in a function.


In my testing I see that the glissando is happening after the notes 
instead of between the grace note and the notes.


Walt North

C:/Users/waltn/AppData/Local/Temp/frescobaldi-nrao5slu/tmp4c_xa8e2/document.ly:42:3: 
warning: Unattached GlissandoEvent


  \slideC 4 1 |

The log has the following message:


\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
  }
}

slideA =
#(define-music-function (grace) (ly:pitch?)
   #{
 {
  \once \hideNotes \grace $grace \glissando \unHideNotes
 }
   #})

slideB =
#(define-music-function (sNotes eNotes) (ly:music? ly:music?)
   #{
 {
   \grace $sNotes  $eNotes
 }
   #})

slideC =
#(define-music-function (sNotes eNotes) (ly:music? ly:music?)
   #{
 {
   \grace $sNotes \glissando $eNotes
 }
   #})


\relative c' {
  \grace 4 \glissando 1  |
  \hideNotes \grace 4 \glissando \unHideNotes 1  |
  \slideA a 1 |
  \slideB 4 1 |
  \slideC 4 1 |
  1 |
}






Re: Customizing fretboard diagram

2024-11-23 Thread Stefan E. Mueller

Dear Carl,

thanks for your response. I think it would be worthwhile to have the last
fret plotting and barre width configurable. I am happy to help, just not
sure how useful I can be (never worked with scheme).

If I remove the dots at first fret on string 1 and 5, I see that the
barre-line ends right at the string position. I'd prefer if it would
extend a little to the left and right - if the barre line had the full
thickness of the dots, and one would leave the dots in, this would probably
do. Which brings us back to the necessity to configure the barre
line thickness.

First thing that came to my mind was to decrease the radius of just these
two dots to the barre thickness (half the dot radius), but I think this
is also not (yet) configurable for individual dots. And while I am at it,
sometimes I'd like to put a square in the diagram where the root note is
located, but I think the shape of the individual "dot" (or even all the dots
in the diagrams) seems to be fixed to, well, dots. No squares, triangles,
stars,...So one would need even more configuration options.

Anyway, thanks - I will contact you in separate mail about possible ways
to implement things -

Stefan

--
Stefan E. Mueller

stefan.e.muel...@gmx.de

On Fri, 22 Nov 2024, Carl Sorensen wrote:


Stefan,

See my answers below.  They are answers that only address setting values in
'details.  You could copy the code from scm/fret-diagrams.scm and make
changes to accomplish all of these things, if you wanted to.  But those
changes would be in your own file.

On Fri, Nov 22, 2024 at 8:07 PM Stefan E. Mueller 
wrote:
  Hi,

  I have this fretboard diagram:


  Is there a possibility to add a closing line at the 5h fret?


 Currently, no.  The particular diagram you are showing does not have a 5th
fret.  It has only the nut (zeroth fret) and frets 1-4.  The strings are
hardcoded to go one fret space below the last fret in the diagram.

It would be relatively easy to add a 'details property that would control
whether or not the strings extend beyond the last fret.

You could hardcode the changed behavior by changing the draw-strings
procedure in fret-diagrams.scm:

    (define (draw-strings)
      "Draw the string lines for a fret diagram with
@var{string-count} strings and frets as indicated in @var{fret-range}.
Line thickness is given by @var{th}, fret & string spacing by
@var{size}.  Orientation is determined by @var{orientation}."
      (let* ((string-list (iota string-count 1 1))
             (string-stencils (map string-stencil string-list)))
        (apply ly:stencil-add empty-stencil string-stencils)))

    (define (string-stencil string)
      "Make a stencil for @code{string}, given the fret-diagram
      overall parameters."
      (let* ((string-coordinate (- string-count string))
             (current-string-thickness
              (* th size (string-thickness string thickness-factor)))
             (fret-half-thick (* size th 0.5))
             (string-half-thick (* current-string-thickness 0.5))
             (start-coordinates
              (stencil-coordinates
               (- fret-half-thick)
               (- (* size string-distance string-coordinate)
                  string-half-thick)))
             (end-coordinates
              (stencil-coordinates
               (+ fret-half-thick
                  (* size fret-distance ( (fret-count fret-range ; this
is the new line
                  ;(* size fret-distance (1+ (fret-count fret-range ;
this was the previous line
               (+ string-half-thick
                  (* size string-distance string-coordinate)
        (ly:round-filled-box
         (ordered-cons (car start-coordinates) (car end-coordinates))
         (ordered-cons (cdr start-coordinates) (cdr end-coordinates))
         (* th size
 
  And also I
  would like to to get rid of the dots at first fret on string 1
  and 5


Just don't include (place-fret 5 1) and (place-fret 1 1) as part of the
diagram.
 
  and/or be able to increase the bar thickness for the barre (the
  thickness
  can be changed for "capo", but I could not find a possibility to
  change
  the thickness for the straight "barre" line).


Currently, the barre thickness is hard-coded to be the dot-radius (1/2 the
diameter of the dot).  
A new property could easily be added to the details that would set the
thickness of the barre line.  Is your desire to make the barre thickness be
the same as the dot diameter?

You could also edit the draw-barre function in fret-diagrams.scm to hardcode
a new barre thickness:
    (define (draw-barre barre-list)
      "Create barre indications for a fret diagram"
      (let* ((low-fret (car fret-range))
             (barre-vertical-offset 0.5)
             (scale-dot-radius (* size dot-radius))
             (barre-type (assoc-get 'barre-type details 'curved))
             (barre-stils
              (map
               (lambda (barre)
                 (le

Combining split-out instruments

2024-11-23 Thread Philip Harris via LilyPond user discussion

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 might want to do this 
"properly" :-)


Thanks

Phil
\version "2.19.21"

#(ly:set-option 'point-and-click #f)
#(set-global-staff-size 24)

\header {
	title = "Bass and Tam"
}

tamborim_notes = \drummode {
	cb	r	cb	r
	cb	r	cb	r
	r	cb	r	cb
	cb	r	r	r
}
tamborim_words = \lyricmode {
	one		two	
	three		four	
		one		"2"
	"3"
}

pulse_notes = \drummode {
	r	r	r	r
	bd	r	r	r
	r	r	r	r
	bd	r	r	r
}
pulse_words = \lyricmode {
}
#(define mysamba
	'(
 	(cowbell	default   #f   0)

 	(bassdrum	default   #f   -1)
	)
)

music = {
	<<
		\new DrumStaff \with {
			instrumentName = "Tamborim "
			drumStyleTable = #(alist->hash-table mysamba)
			\override StaffSymbol.line-count = #1
			\override StaffSymbol.staff-space = #1
			\override Stem.transparent = ##t
			\override NoteHead.X-offset = #0
			\override StaffSymbol.line-positions = #'( 0 )
			\override Stem.X-offset = #1.25
			\override Stem.Y-offset = #0.25
			\override Staff.Rest.style = #'mensural
			\override Rest.staff-position = 0
			\omit Score.TimeSignature
		}  {
			\repeat volta 3
			\new DrumVoice { \voiceOne	\tamborim_notes }
			\addlyrics \tamborim_words
		}
		\new DrumStaff \with {
			instrumentName = "Both "
			drumStyleTable = #(alist->hash-table mysamba)
			\override StaffSymbol.line-count = #4
			\override StaffSymbol.staff-space = #3
			\override Stem.transparent = ##t
			\override NoteHead.X-offset = #0
			\override StaffSymbol.line-positions = #'( 0 -1 )
			\override Stem.X-offset = #1.25
			\override Stem.Y-offset = #0.25
			\override Staff.Rest.style = #'mensural
			\override Rest.staff-position = -0.5
			\override Staff.clef-Position = -0.5
			\omit Score.TimeSignature
		}  {
			\repeat volta 3
			<<
\new DrumVoice { \voiceOne \pulse_notes }
\new DrumVoice { \voiceTwo \tamborim_notes }
			>>
		}
		\new DrumStaff \with {
			instrumentName = "Pulse "
			drumStyleTable = #(alist->hash-table mysamba)
			\override StaffSymbol.line-count = #1
			\override StaffSymbol.staff-space = #1
			\override Stem.transparent = ##t
			\override NoteHead.X-offset = #0
			\override StaffSymbol.line-positions = #'( -1 )
			\override Stem.X-offset = #1.25
			\override Stem.Y-offset = #0.25
			\override Staff.Rest.style = #'mensural
			\override Rest.staff-position = -1
			\omit Score.TimeSignature
		}  {
			\repeat volta 3
			\new DrumVoice { \voiceOne	\pulse_notes }
			\addlyrics \pulse_words
		}
	>>
}

\score {
	\music
	\layout {
	}
}


bd-cb-example.pdf
Description: Adobe PDF document