Re: A query about tablature

2023-08-07 Thread Alasdair McAndrew
I should add that those remarks of mine were not meant as complaints about
Lilypond; merely as observations.  I'm very aware that as an open-source
project, Lilypond's strength derives from the hard, unpaid, tireless and
often thankless work by its developers.  It is often said about open source
projects that if you want some particular functionality, you should write
it yourself and submit it for review.  However, my programming skills (at
least in scheme) are too poor for this myself.

But maybe your code could be submitted to be part of Lilypond in future?

Alasdair

On Tue, 8 Aug 2023 at 11:48, Alasdair McAndrew  wrote:

> Dear Lukas-Fabian (if I may),
>
> Thank you very much - that is quite amazing!  But it does show what I have
> long suspected: that without some extra programming, Lilypond does not have
> a current facility to extract the rhythm from a music definition.  All of
> the tablatures I've seen in Lilypond require the music to be entered twice:
> once fully, and the other as durations only.   As well, the
> tablature section in the documentation nowhere shows how to do this: to
> create a tablature score with just the rhythm above it.   Maybe this will
> be amended in future versions?
>
> Thank you again,
> Alasdair
>
> On Tue, 8 Aug 2023 at 06:15, Lukas-Fabian Moser  wrote:
>
>> Hi Alasdair,
>>
>> Am 07.08.23 um 07:05 schrieb Alasdair McAndrew:
>> > In fact you can just look at the snippet at
>> > https://lsr.di.unimi.it/LSR/Item?id=848 I've set mine up slightly
>> > differently, with letters between the lines, but the principle is the
>> > same.  But as you see from this snippet, you have to enter the notes
>> > and values for the tablature stave, and the note durations again (with
>> > appropriate "silent" notes) for the rhythm stave.  And both these
>> > staves have to be created independently and put together at the end.
>> >
>> > I want to know if you can do this without having to enter the rhythm
>> > durations and stave separately - the information in "myNotes" in the
>> > snippet contains all the information needed. I'm hoping for a solution
>> > where all you need to enter is "myNotes", and then both the tablature
>> > staff and the rhythm staff would be created in one go.
>> >
>> > Thank you again.
>>
>> That's basically a matter of programmatically turning the given music
>> into bare (pitch-less) durations while skipping repeated durations.
>>
>> Question: What should be done for actual rests in the input?
>>
>> One possible approach might be:
>>
>> \version "2.24.0"
>>
>> %% http://lsr.di.unimi.it/LSR/Item?id=848
>> %LSR modified by P.P.Schneider on Feb.2014 for v2.18
>> % modified by L.-F. Moser in Aug. 2023
>> % (added \extractRhythm and \tabStaves)
>>
>> %{ Tablature layout for viol music
>>
>> The snippet defines a specialized group of rhythmic and
>> tablature staves able to handle old english viol tablature
>> scores.
>>
>> The string tunings defaults to the most common viol in d
>> but other usual tunings are also available.
>>
>> The rhythm part is used to provide only the pace changes,
>> and therefore must be provided as a supplementary voice.
>> %}
>>
>> viol-in-d-tuning = \stringTuning 
>>
>> viol-in-d-scord-tuning = \stringTuning 
>>
>> viol-in-g-tuning = \stringTuning 
>>
>> ViolTabLayout = \layout {
>>\context {
>>  \RhythmicStaff
>>  \type "Engraver_group"
>>  \name "ViolTabRhythmicStaff"
>>  \alias "RhythmicStaff"
>>
>>  \description "Handles rhythm part of viol tablature."
>>
>>  \remove "Time_signature_engraver"
>>  \remove "Staff_symbol_engraver"
>>  \remove "Bar_engraver"
>>
>>  fontSize = #-3
>>  \override StaffSymbol.staff-space = #(magstep -3)
>>  \override Stem.length = #5
>>  \override VerticalAxisGroup.staff-staff-spacing =
>>  #'((basic-distance . 1)
>> (minimum-distance . 1)
>> (padding . 1))
>>
>>  % useful to merge chords noteheads
>>  \override NoteHead.X-offset = #0
>>}
>>
>>\context {
>>  \TabStaff
>>  \type "Engraver_group"
>>  \name "ViolTabFingeringStaff"
>>  \alias "Staff"
>>
>>  \description "Handles fingering part of viol tablature."
>>
>>  tablatureFormat = #fret-letter-tablature-format
>>  stringTunings = #viol-in-d-tuning
>>
>>  % useful for tablature only scores
>>  \revert TimeSignature.stencil
>>  \override TimeSignature.style = #'single-digit
>>}
>>
>>\context {
>>  \type "Engraver_group"
>>  \name "ViolTabStaff"
>>  \consists "Vertical_align_engraver"
>>  topLevelAlignment = ##f
>>
>>  \description "Handles viol tablature."
>>
>>  \defaultchild "ViolTabFingeringStaff"
>>  \accepts "ViolTabRhythmicStaff"
>>  \accepts "ViolTabFingeringStaff"
>>}
>>
>>\context {
>>  \Score
>>  \accepts "ViolTabStaff"
>>}
>> }
>>
>> %
>>
>> #(define rest-or-skip?
>> (music-type-predicate '(skip-event 

Re: A query about tablature

2023-08-07 Thread Alasdair McAndrew
Dear Lukas-Fabian (if I may),

Thank you very much - that is quite amazing!  But it does show what I have
long suspected: that without some extra programming, Lilypond does not have
a current facility to extract the rhythm from a music definition.  All of
the tablatures I've seen in Lilypond require the music to be entered twice:
once fully, and the other as durations only.   As well, the
tablature section in the documentation nowhere shows how to do this: to
create a tablature score with just the rhythm above it.   Maybe this will
be amended in future versions?

Thank you again,
Alasdair

On Tue, 8 Aug 2023 at 06:15, Lukas-Fabian Moser  wrote:

> Hi Alasdair,
>
> Am 07.08.23 um 07:05 schrieb Alasdair McAndrew:
> > In fact you can just look at the snippet at
> > https://lsr.di.unimi.it/LSR/Item?id=848 I've set mine up slightly
> > differently, with letters between the lines, but the principle is the
> > same.  But as you see from this snippet, you have to enter the notes
> > and values for the tablature stave, and the note durations again (with
> > appropriate "silent" notes) for the rhythm stave.  And both these
> > staves have to be created independently and put together at the end.
> >
> > I want to know if you can do this without having to enter the rhythm
> > durations and stave separately - the information in "myNotes" in the
> > snippet contains all the information needed. I'm hoping for a solution
> > where all you need to enter is "myNotes", and then both the tablature
> > staff and the rhythm staff would be created in one go.
> >
> > Thank you again.
>
> That's basically a matter of programmatically turning the given music
> into bare (pitch-less) durations while skipping repeated durations.
>
> Question: What should be done for actual rests in the input?
>
> One possible approach might be:
>
> \version "2.24.0"
>
> %% http://lsr.di.unimi.it/LSR/Item?id=848
> %LSR modified by P.P.Schneider on Feb.2014 for v2.18
> % modified by L.-F. Moser in Aug. 2023
> % (added \extractRhythm and \tabStaves)
>
> %{ Tablature layout for viol music
>
> The snippet defines a specialized group of rhythmic and
> tablature staves able to handle old english viol tablature
> scores.
>
> The string tunings defaults to the most common viol in d
> but other usual tunings are also available.
>
> The rhythm part is used to provide only the pace changes,
> and therefore must be provided as a supplementary voice.
> %}
>
> viol-in-d-tuning = \stringTuning 
>
> viol-in-d-scord-tuning = \stringTuning 
>
> viol-in-g-tuning = \stringTuning 
>
> ViolTabLayout = \layout {
>\context {
>  \RhythmicStaff
>  \type "Engraver_group"
>  \name "ViolTabRhythmicStaff"
>  \alias "RhythmicStaff"
>
>  \description "Handles rhythm part of viol tablature."
>
>  \remove "Time_signature_engraver"
>  \remove "Staff_symbol_engraver"
>  \remove "Bar_engraver"
>
>  fontSize = #-3
>  \override StaffSymbol.staff-space = #(magstep -3)
>  \override Stem.length = #5
>  \override VerticalAxisGroup.staff-staff-spacing =
>  #'((basic-distance . 1)
> (minimum-distance . 1)
> (padding . 1))
>
>  % useful to merge chords noteheads
>  \override NoteHead.X-offset = #0
>}
>
>\context {
>  \TabStaff
>  \type "Engraver_group"
>  \name "ViolTabFingeringStaff"
>  \alias "Staff"
>
>  \description "Handles fingering part of viol tablature."
>
>  tablatureFormat = #fret-letter-tablature-format
>  stringTunings = #viol-in-d-tuning
>
>  % useful for tablature only scores
>  \revert TimeSignature.stencil
>  \override TimeSignature.style = #'single-digit
>}
>
>\context {
>  \type "Engraver_group"
>  \name "ViolTabStaff"
>  \consists "Vertical_align_engraver"
>  topLevelAlignment = ##f
>
>  \description "Handles viol tablature."
>
>  \defaultchild "ViolTabFingeringStaff"
>  \accepts "ViolTabRhythmicStaff"
>  \accepts "ViolTabFingeringStaff"
>}
>
>\context {
>  \Score
>  \accepts "ViolTabStaff"
>}
> }
>
> %
>
> #(define rest-or-skip?
> (music-type-predicate '(skip-event general-rest-event)))
>
> extractRhythm =
> #(define-music-function (mus) (ly:music?)
> (make-music
>  'SequentialMusic
>  'elements
>  (let loop
>((remaining-notes
>  (extract-typed-music (event-chord-reduce mus)
>   'rhythmic-event))
> (current-duration #f))
>
>(if
> (null? remaining-notes)
> '()
> (let*
>  ((note (car remaining-notes))
>   (duration (ly:music-property note 'duration)))
>  (cons
>   (make-music
>(if (or (rest-or-skip? note)
>(equal? duration current-duration))
>'SkipEvent
>'NoteEvent)
>'duration duration)
>   (loop (cdr remaining-notes)
>   

Re: How to center note names horizontally

2023-08-07 Thread Gerardo Ballabio
It works, thank you very much!

Gerardo

Il giorno dom 6 ago 2023 alle ore 18:31 Jean Abou Samra
 ha scritto:
>
> Le dimanche 06 août 2023 à 18:21 +0200, Gerardo Ballabio a écrit :
>
> Hello, is there a way to center note names horizontally around the 
> corresponding note? Since I'm using Italian note names they have different 
> lengths, I believe that centering them would look better. Example below. The 
> space between "sol" and "la" looks particularly awkward (too small).
>
> This is the default in version 2.25.4 and later. In 2.24, you can do
>
> \version "2.24.1"
>
> \layout {
>   \context {
> \NoteNames
> \override NoteName.X-offset = 
> #ly:self-alignment-interface::aligned-on-x-parent
> \override NoteName.self-alignment-X = #CENTER
>   }
> }
>
>
> <<
> \relative c' { f g a }
> \new NoteNames {
>   \set printNotesLanguage = "italiano"
>   f g a
> }
> >>
>
> Best,
>
> Jean



Re: Is there a Scheme macro(?) to use fretboards to generate a generic guitar strum?

2023-08-07 Thread Lukas-Fabian Moser

Hi David,


arpeggiateChord = #
(define-music-function (chord) (ly:music?)

Just a warning: inventing unconventional formattings like this (putting
# on a different line as the opening paren) carries the danger of
keeping convert-ly (and syntax highlighters and syntax-sensitive
editors) from recognizing the construct.


Good point, thanks. I got into the habit of adding a newline after # in 
order to let Frescobaldi's autoformatter create Scheme code that I can 
copy into .scm files. But of course there's fixscm.sh, and we 
don't deal with .scm files here anyway.


Lukas




Re: A query about tablature

2023-08-07 Thread Lukas-Fabian Moser

Hi Alasdair,

Am 07.08.23 um 07:05 schrieb Alasdair McAndrew:
In fact you can just look at the snippet at 
https://lsr.di.unimi.it/LSR/Item?id=848 I've set mine up slightly 
differently, with letters between the lines, but the principle is the 
same.  But as you see from this snippet, you have to enter the notes 
and values for the tablature stave, and the note durations again (with 
appropriate "silent" notes) for the rhythm stave.  And both these 
staves have to be created independently and put together at the end.


I want to know if you can do this without having to enter the rhythm 
durations and stave separately - the information in "myNotes" in the 
snippet contains all the information needed. I'm hoping for a solution 
where all you need to enter is "myNotes", and then both the tablature 
staff and the rhythm staff would be created in one go.


Thank you again.


That's basically a matter of programmatically turning the given music 
into bare (pitch-less) durations while skipping repeated durations.


Question: What should be done for actual rests in the input?

One possible approach might be:

\version "2.24.0"

%% http://lsr.di.unimi.it/LSR/Item?id=848
%LSR modified by P.P.Schneider on Feb.2014 for v2.18
% modified by L.-F. Moser in Aug. 2023
% (added \extractRhythm and \tabStaves)

%{ Tablature layout for viol music

The snippet defines a specialized group of rhythmic and
tablature staves able to handle old english viol tablature
scores.

The string tunings defaults to the most common viol in d
but other usual tunings are also available.

The rhythm part is used to provide only the pace changes,
and therefore must be provided as a supplementary voice.
%}

viol-in-d-tuning = \stringTuning 

viol-in-d-scord-tuning = \stringTuning 

viol-in-g-tuning = \stringTuning 

ViolTabLayout = \layout {
  \context {
    \RhythmicStaff
    \type "Engraver_group"
    \name "ViolTabRhythmicStaff"
    \alias "RhythmicStaff"

    \description "Handles rhythm part of viol tablature."

    \remove "Time_signature_engraver"
    \remove "Staff_symbol_engraver"
    \remove "Bar_engraver"

    fontSize = #-3
    \override StaffSymbol.staff-space = #(magstep -3)
    \override Stem.length = #5
    \override VerticalAxisGroup.staff-staff-spacing =
    #'((basic-distance . 1)
   (minimum-distance . 1)
   (padding . 1))

    % useful to merge chords noteheads
    \override NoteHead.X-offset = #0
  }

  \context {
    \TabStaff
    \type "Engraver_group"
    \name "ViolTabFingeringStaff"
    \alias "Staff"

    \description "Handles fingering part of viol tablature."

    tablatureFormat = #fret-letter-tablature-format
    stringTunings = #viol-in-d-tuning

    % useful for tablature only scores
    \revert TimeSignature.stencil
    \override TimeSignature.style = #'single-digit
  }

  \context {
    \type "Engraver_group"
    \name "ViolTabStaff"
    \consists "Vertical_align_engraver"
    topLevelAlignment = ##f

    \description "Handles viol tablature."

    \defaultchild "ViolTabFingeringStaff"
    \accepts "ViolTabRhythmicStaff"
    \accepts "ViolTabFingeringStaff"
  }

  \context {
    \Score
    \accepts "ViolTabStaff"
  }
}

%

#(define rest-or-skip?
   (music-type-predicate '(skip-event general-rest-event)))

extractRhythm =
#(define-music-function (mus) (ly:music?)
   (make-music
    'SequentialMusic
    'elements
    (let loop
  ((remaining-notes
    (extract-typed-music (event-chord-reduce mus)
 'rhythmic-event))
   (current-duration #f))

  (if
   (null? remaining-notes)
   '()
   (let*
    ((note (car remaining-notes))
 (duration (ly:music-property note 'duration)))
    (cons
 (make-music
  (if (or (rest-or-skip? note)
  (equal? duration current-duration))
  'SkipEvent
  'NoteEvent)
  'duration duration)
 (loop (cdr remaining-notes)
   (if (rest-or-skip? note) current-duration duration

%

tabStaves =
#(define-music-function (mus) (ly:music?)
   #{
 <<
   \new Staff \with { \clef bass } {
 #mus
   }
   \new ViolTabStaff {
 <<
   \new ViolTabRhythmicStaff {
 \extractRhythm $mus
   }
   \new ViolTabFingeringStaff { #mus }
 >>
   }
 >>
   #})

myNotes = \relative c {
  4 e f8 g a4
  2. c4
  d4. e8 f4 g
  r8 g g f e4 a
}

%

\score {
  \tabStaves \myNotes
  \layout {
    \ViolTabLayout
  }
}

Lukas




Re: A query about tablature

2023-08-07 Thread David Kastrup
Alasdair McAndrew  writes:

>> On Mon, 7 Aug 2023 at 00:11, David Kastrup  wrote:
>>
>>> Alasdair McAndrew  writes:
>>>
>>> > Thank you very much indeed for your offer.  I'll try to put something
>>> > together: currently my files are split up, so that all common
>>> > definitions are in one file, all music in another, and the layout in a
>>> > third file (which imports the others).  I'll aim to make a simple
>>> > representative file which includes the lot!
>>> >
>>> > But as I said earlier the music is split into two definitions: one
>>> > contains the pitch information, and the other the rhythm.  These are
>>> > then put together as I described in my first post.
>>>
>>> Why?
>
> I'm not quite sure what the "why" refers to:

It refers to splitting the music input into rhythm and pitch information
rather than entering rhythm and pitch in concert as LilyPond is designed
to do.

> but I'm attempting to typeset some material from a 1607 publication,
> which in the original has two tablature parts and one score part for
> each piece.  I'm aiming to do several things here: transcribe the
> publication so that it's easy to read (so with tablature); create an
> edition entirely in modern score; and also allow for playing by
> instruments at different pitches.  The title page announces that each
> piece could be "plaied 8, severall waies upon sundry Instruments", and
> so I'm trying to make that facility available to the modern player.
>
> Alasdair

-- 
David Kastrup



Re: Need help displaying note names in 2.22

2023-08-07 Thread Jean Abou Samra
Le lundi 07 août 2023 à 19:00 +0100, Viktor Mastoridis a écrit :
> How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without braking
> the system?



Just follow the tutorial, it will not interfere with the system in any way.

https://lilypond.org/doc/v2.24/Documentation/learning/graphical-setup-under-gnu_002flinux.html


(You presumably already have Frescobaldi, so you don't need that part, only the
part where it explains how to add a new LilyPond version to Frescobaldi.)


signature.asc
Description: This is a digitally signed message part


Re: Need help displaying note names in 2.22

2023-08-07 Thread Viktor Mastoridis
On Sunday, 6 August 2023, Jean Abou Samra  wrote:

> Oops, except that this is not going to work in 2.22, since
> \with-string-transformer is new in 2.24.
>
> However, 2.22 is not supported anymore, I would recommend upgrading to
> 2.24 anyway.
>

How do I upgrade to Lilypond 2.24 on Mint 21 (Ubuntu LTS 22.4) without
braking the system?

Viktor


-- 
Viktor Mastoridis