Autor Thema: Neues Code Snippet - Akkordeon Standard Stradella Basssystem zeichnen  (Gelesen 8173 mal)

Manuela

  • Member
Hi, ich habe wieder mal an einem CodeSnippet gebastelt, d.h. es ist schon ein bisschen größer als ein Snippet  ;)

Bevor ich es ins LSR stelle, möchte ich es hier einstellen. Das Snippet zeichnet ein Standard Stradella Basssystem wie hier gezeigt https://commons.wikimedia.org/wiki/Category:Stradella_bass_system

Das Problem besteht darin, dass ich zwei verschiedene Varianten wie im Anhang vorführen möchte, jedoch wirkt sich die Variablenänderung der 2. Variante auch auf die erste Variante aus.

Hier der Code:

\version "2.18.0"
\language "deutsch"

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Drawing a standard Stradella Accordion Bass
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% defining circle diameter and distances
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define dm-circle 3.3) %% the radius of the buttons
#(define col-dist (+ (* 2 dm-circle) 0.1)) %% distance between 2 button columns, default: 2*radius plus a little
#(define row-dist 1) %% the vertical distance of the button rows, check out smaller values
#(define h-shift dm-circle) %% defines much a button row is shifted horizontally relativ to the next lower row

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% pitch+music functions and definitions
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define (pitch-equals? p1 p2)
   ;(write-me "pitch-equals? ----------------------------> " (list p1 p2))
   (and
    (= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
    (= (ly:pitch-notename p1) (ly:pitch-notename p2))))

#(define (note-name->german-string pitch)
   (define (pitch-alteration-semitones pitch)
     (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
   (let* ((name (ly:pitch-notename pitch))
          (alt-semitones (pitch-alteration-semitones pitch))
          (n-a (if (equal? (cons name alt-semitones) '(6 . -1))
                   (cons 7 alt-semitones)
                   (if (equal? (cons name alt-semitones) '(6 . -2))
                       (cons 7 -2)
                       (cons name alt-semitones)
                       )
                   )))
     (string-append
      (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
      (let ((alteration (/ (cdr n-a) 2)))
        ;(write-me "alteration: -------------> " alteration)
        (cond
         ((and (= alteration FLAT) (= (car n-a) 7))
          "")
         ((and (= alteration DOUBLE-FLAT) (= (car n-a) 7)) ;; we write Heses as Bes because it is shorter
           "es")
         ((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2) ))
          "s")
         ((= alteration FLAT)
          "es")
         ((and (= alteration DOUBLE-FLAT) (or (= (car n-a) 5)(= (car n-a) 2)))
          "ses")
         ((= alteration DOUBLE-FLAT)
          "eses")
         ((= alteration SHARP)
          "is")
         ((= alteration DOUBLE-SHARP)
          "isis")
         (else ""))))))

#(define Q-circle ;; define circle of fifths as pitchlist
   (list
    (ly:make-pitch 0 6 DOUBLE-FLAT) ;; heses
    (ly:make-pitch 0 3 FLAT)        ;; fes
    (ly:make-pitch 0 0 FLAT)        ;; ces
    (ly:make-pitch 0 4 FLAT)        ;; ges
    (ly:make-pitch 0 1 FLAT)        ;; des
    (ly:make-pitch 0 5 FLAT)        ;; as
    (ly:make-pitch 0 2 FLAT)        ;; es
    (ly:make-pitch 0 6 FLAT)        ;; b
    (ly:make-pitch 0 3 0)           ;; f
    (ly:make-pitch 0 0 0)           ;; c
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    (ly:make-pitch 0 5 0)           ;; a
    (ly:make-pitch 0 2 0)           ;; e
    (ly:make-pitch 0 6 0)           ;; h
    (ly:make-pitch 0 3 SHARP)       ;; fis
    (ly:make-pitch 0 0 SHARP)       ;; cis
    (ly:make-pitch 0 4 SHARP)       ;; gis
    (ly:make-pitch 0 1 SHARP)       ;; dis
    (ly:make-pitch 0 5 SHARP)       ;; ais
    ))

#(define Terz-circle ;; define terzbasses
   (list
    (ly:make-pitch 0 1 FLAT)        ;; des
    (ly:make-pitch 0 5 FLAT)        ;; as
    (ly:make-pitch 0 2 FLAT)        ;; es
    (ly:make-pitch 0 6 FLAT)        ;; b
    (ly:make-pitch 0 3 0)           ;; f
    (ly:make-pitch 0 0 0)           ;; c
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    (ly:make-pitch 0 5 0)           ;; a
    (ly:make-pitch 0 2 0)           ;; e
    (ly:make-pitch 0 6 0)           ;; h
    (ly:make-pitch 0 3 SHARP)       ;; fis
    (ly:make-pitch 0 0 SHARP)       ;; cis
    (ly:make-pitch 0 4 SHARP)       ;; gis
    (ly:make-pitch 0 1 SHARP)       ;; dis
    (ly:make-pitch 0 5 SHARP)       ;; ais
    (ly:make-pitch 0 2 SHARP)       ;; eis
    (ly:make-pitch 0 6 SHARP)       ;; his
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    ))

#(define (get-Index p)
   (list-index (lambda(x)(pitch-equals? x p)) Q-circle))

#(define (get-Name p)
   (note-name->german-string p))

#(define (DMSV n)
   ;; n=0: "Dur-"
   ;; n=1: Moll
   ;; n=2: Sept
   ;; n=3: Dim
   (cond
    ( (= n 0) "")
    ((= n 1) "m")
    ((= n 2) "7")
    ((= n 3) "o")
    ))

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% markup functions
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define (ChordName->markup p n)
   (let* ((m (- n 2))
          (bname (string-downcase (get-Name p)))
          (cname (string-capitalize bname))
          (i (get-Index p))
          (terz (get-Name (list-ref Terz-circle i)))
          (simple
           (cond
            ((>= n 2)
             bname)
            ((= n 1)
             cname)
            (else terz)
            ))
          (hoch
           (cond
            ((>= n 3) (DMSV m))
            (else ""))))
     (make-concat-markup
      (list
       (make-simple-markup simple)
       (make-smaller-markup
        (make-raise-markup 0.6 (make-simple-markup hoch)))))))

rowDist=#(define-scheme-function (dist)
           (number?)
           (set! row-dist dist))

colDist=#(define-scheme-function (dist)
           (number?)
           (set! col-dist dist))

slope=#(define-scheme-function (dist)
         (number?)
         (set! h-shift dist))

#(define-markup-command (draw-acc-bass layout props)()
   #:properties ((font-size 0) (thickness 2.5) (offset 3.5))
   (let* ((my-circle (make-circle-stencil dm-circle 0.1 #f))
           (thick (* (magstep font-size) (ly:output-def-lookup layout 'line-thickness)))
          (underline-thick (* thickness thick))
          (y (* thick (- offset)))
          )
     ;procedure body
     (apply ly:stencil-add
       empty-stencil
       (map
        (lambda (z)
          (ly:stencil-translate
           (apply ly:stencil-add
             empty-stencil
             (map
              (lambda (x)
                (let* ((m
                        (interpret-markup layout props
                          (ChordName->markup (list-ref Q-circle x) z)))
                       (myx  (ly:stencil-extent m X))
                       (xstart (car myx))
                       (xend (cdr myx))
                       (breite (- xend xstart))
                       (myy  (ly:stencil-extent m Y))
                       (hoch (- (cdr myy) (car myy))))
                  (ly:stencil-translate-axis
                   (ly:stencil-add
                    (ly:stencil-translate-axis
                     (ly:stencil-translate-axis
                      (ly:stencil-add
                       (if (= 0 z)
                           (make-line-stencil underline-thick xstart y xend y)
                           empty-stencil)
                       m)
                      (- 0 (/ breite 2)) X)
                     (- 0 (/ hoch 2)) Y) ;; chordname plus underline if terzbass
                    my-circle) ;; circled chordname
                   (* x col-dist) X)))
              (iota 20 0)))
           (cons (* z h-shift) (* z col-dist (* row-dist -1)))))
        (iota 6)))))


\bookpart {
  \rowDist #1
  \colDist #(+ dm-circle dm-circle 0.2)
  \slope #dm-circle
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with standard distances"
      \vspace #2 \translate #'(0 . 0 ) \scale #'(0.75 . 0.75) \draw-acc-bass
    }
  }
}

\bookpart {
  \rowDist #0.8
  \colDist #(+ dm-circle dm-circle -1)
  \slope  #(* -0.5 dm-circle)
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with some funny distances"
      \vspace #2 \translate #'(10 . 0 ) \scale #'(0.9 . 0.9) \draw-acc-bass
    }
  }
}
« Letzte Änderung: Dienstag, 30. August 2016, 21:31 von Manuela »

fugenkomponist

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #1 am: Sonntag, 28. August 2016, 13:33 »
Dein Code kompiliert nicht mit Version 2.18.0, könntest du das kurz ändern?

Edit: Mit 2.19.46 gehts. LilyPond prüft nur, ob die verwendete Version größer ist als die in der \version-Angabe, deshalb gabs keinen Fehler, als du (vermutlich) 2.19.xx draufgeschmissen und \version "2.18.0" in die Datei geschrieben hast.

2. Edit: Ansonsten: Was spricht dagegen, die drei Abstände als Argumente an \draw-acc-bass zu übergeben?

3. Edit: Das sähe dann so aus:[...]

#(define-markup-command
  (draw-acc-bass layout props row-dist col-dist h-shift)
  (number? number? number?)
  #:properties ((font-size 0) (thickness 2.5) (offset 3.5))

[...]

\bookpart {
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with standard distances"
      \vspace #2 \translate #'(0 . 0 ) \scale #'(0.75 . 0.75)
      \draw-acc-bass #1 #(+ dm-circle dm-circle 0.2) #dm-circle
    }
  }
}

\bookpart {
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with some funny distances"
      \vspace #2 \translate #'(10 . 0 ) \scale #'(0.9 . 0.9)
      \draw-acc-bass #0.8 #(+ dm-circle dm-circle -1) #(* -0.5 dm-circle)
    }
  }
}

Die Befehle \rowDist etc. brauchst du dann natürlich nicht mehr.
« Letzte Änderung: Sonntag, 28. August 2016, 13:43 von fugenkomponist »

Manuela

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #2 am: Sonntag, 28. August 2016, 13:41 »
Dein Code kompiliert nicht mit Version 2.18.0, könntest du das kurz ändern?

Ich habe Version 2.18.0 nicht installiert. Lilybin ist wieder einmal down  :(, wo ich wenigstens 2.18.2 testen könnte.

fugenkomponist

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #3 am: Sonntag, 28. August 2016, 13:43 »
Das solltest du wohl tun, wenn du regelmäßig was zum LSR beitragen möchtest, es gibt einfach so viele Dinge, die in 2.19 schon anders sind (weshalb immer mal wieder auch Leute sagen, dass es Zeit für eine 2.20 sei).

Hab ne Lösung oben als 3. Edit, da hattest du aber anscheinend schon geantwortet.

Manuela

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #4 am: Sonntag, 28. August 2016, 13:45 »
Unsere Beiträge haben sich überschnitten  :D

2. Edit: Ansonsten: Was spricht dagegen, die drei Abstände als Argumente an \draw-acc-bass zu übergeben?


Klar könnte ich das auch machen. Ich habe jedoch die Erfahrung gemacht, dass es mich nervt, wenn zu viele Parameter beim Aufruf einer Funktion einzugeben sind. Es sei denn, man könnte die Eingabe optional machen, irgendwo habe ich das gesehen, weiß jedoch nicht mehr wo.

fugenkomponist

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #5 am: Sonntag, 28. August 2016, 13:55 »
Ja, in Musikfunktionen geht das, bei markup-commands anscheinend nicht (bzw. falls doch, weiß ich nicht, wie). Aber wie wärs damit?draw-acc-bass-default =
\markup \draw-acc-bass #1 #(+ dm-circle dm-circle 0.2) #dm-circle

\bookpart {
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with standard distances"
      \vspace #2 \translate #'(0 . 0 ) \scale #'(0.75 . 0.75)
      \draw-acc-bass-default
    }
  }
}

\bookpart {
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with some funny distances"
      \vspace #2 \translate #'(10 . 0 ) \scale #'(0.9 . 0.9)
      \draw-acc-bass #0.8 #(+ dm-circle dm-circle -1) #(* -0.5 dm-circle)
    }
  }
}

Edit: Davon abgesehen ist das ja auch kein realer Anwendungsfall, das Diagramm mehr als einmal drucken zu wollen und dann auch noch mit verschiedenen Maßen. Also eigentlich kein Problem.
« Letzte Änderung: Sonntag, 28. August 2016, 13:57 von fugenkomponist »

Manuela

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #6 am: Sonntag, 28. August 2016, 14:35 »
Edit: Davon abgesehen ist das ja auch kein realer Anwendungsfall, das Diagramm mehr als einmal drucken zu wollen und dann auch noch mit verschiedenen Maßen. Also eigentlich kein Problem.

Du hast recht, das wäre nur für Demonstrationszwecke gewesen. Trotzdem verstehe ich nicht, wieso die Zuordnung den davor stehenden Code beeinflusst. Ich habe eigens zwei bookparts angelegt in der Hoffnung, dass Lilypond die Umgebungen irgendwie trennt. Hat nix genutzt.

Und immer wieder falle ich darauf rein, dass in den Versionen 2.18.xx "parser location" in musicfunktionen verwendet werden muss.

Ich hoffe, das hier kompiliert:

\version "2.18.0"
\language "deutsch"

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Drawing a standard Stradella Accordion Bass
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% defining circle diameter and distances
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define dm-circle 3.3) %% the radius of the buttons
#(define col-dist (+ (* 2 dm-circle) 0.1)) %% distance between 2 button columns, default: 2*radius plus a little
#(define row-dist 1) %% the vertical distance of the button rows, check out smaller values
#(define h-shift dm-circle) %% defines much a button row is shifted horizontally relativ to the next lower row

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% pitch+music functions and definitions
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define (pitch-equals? p1 p2)
   ;(write-me "pitch-equals? ----------------------------> " (list p1 p2))
   (and
    (= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
    (= (ly:pitch-notename p1) (ly:pitch-notename p2))))

#(define (note-name->german-string pitch)
   (define (pitch-alteration-semitones pitch)
     (inexact->exact (round (* (ly:pitch-alteration pitch) 2))))
   (let* ((name (ly:pitch-notename pitch))
          (alt-semitones (pitch-alteration-semitones pitch))
          (n-a (if (equal? (cons name alt-semitones) '(6 . -1))
                   (cons 7 alt-semitones)
                   (if (equal? (cons name alt-semitones) '(6 . -2))
                       (cons 7 -2)
                       (cons name alt-semitones)
                       )
                   )))
     (string-append
      (vector-ref #("C" "D" "E" "F" "G" "A" "H" "B") (car n-a))
      (let ((alteration (/ (cdr n-a) 2)))
        ;(write-me "alteration: -------------> " alteration)
        (cond
         ((and (= alteration FLAT) (= (car n-a) 7))
          "")
         ((and (= alteration DOUBLE-FLAT) (= (car n-a) 7)) ;; we write Heses as Bes because it is shorter
           "es")
         ((and (= alteration FLAT) (or (= (car n-a) 5) (= (car n-a) 2) ))
          "s")
         ((= alteration FLAT)
          "es")
         ((and (= alteration DOUBLE-FLAT) (or (= (car n-a) 5)(= (car n-a) 2)))
          "ses")
         ((= alteration DOUBLE-FLAT)
          "eses")
         ((= alteration SHARP)
          "is")
         ((= alteration DOUBLE-SHARP)
          "isis")
         (else ""))))))

#(define Q-circle ;; define circle of fifths as pitchlist
   (list
    (ly:make-pitch 0 6 DOUBLE-FLAT) ;; heses
    (ly:make-pitch 0 3 FLAT)        ;; fes
    (ly:make-pitch 0 0 FLAT)        ;; ces
    (ly:make-pitch 0 4 FLAT)        ;; ges
    (ly:make-pitch 0 1 FLAT)        ;; des
    (ly:make-pitch 0 5 FLAT)        ;; as
    (ly:make-pitch 0 2 FLAT)        ;; es
    (ly:make-pitch 0 6 FLAT)        ;; b
    (ly:make-pitch 0 3 0)           ;; f
    (ly:make-pitch 0 0 0)           ;; c
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    (ly:make-pitch 0 5 0)           ;; a
    (ly:make-pitch 0 2 0)           ;; e
    (ly:make-pitch 0 6 0)           ;; h
    (ly:make-pitch 0 3 SHARP)       ;; fis
    (ly:make-pitch 0 0 SHARP)       ;; cis
    (ly:make-pitch 0 4 SHARP)       ;; gis
    (ly:make-pitch 0 1 SHARP)       ;; dis
    (ly:make-pitch 0 5 SHARP)       ;; ais
    ))

#(define Terz-circle ;; define terzbasses
   (list
    (ly:make-pitch 0 1 FLAT)        ;; des
    (ly:make-pitch 0 5 FLAT)        ;; as
    (ly:make-pitch 0 2 FLAT)        ;; es
    (ly:make-pitch 0 6 FLAT)        ;; b
    (ly:make-pitch 0 3 0)           ;; f
    (ly:make-pitch 0 0 0)           ;; c
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    (ly:make-pitch 0 5 0)           ;; a
    (ly:make-pitch 0 2 0)           ;; e
    (ly:make-pitch 0 6 0)           ;; h
    (ly:make-pitch 0 3 SHARP)       ;; fis
    (ly:make-pitch 0 0 SHARP)       ;; cis
    (ly:make-pitch 0 4 SHARP)       ;; gis
    (ly:make-pitch 0 1 SHARP)       ;; dis
    (ly:make-pitch 0 5 SHARP)       ;; ais
    (ly:make-pitch 0 2 SHARP)       ;; eis
    (ly:make-pitch 0 6 SHARP)       ;; his
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    ))

#(define (get-Index p)
   (list-index (lambda(x)(pitch-equals? x p)) Q-circle))

#(define (get-Name p)
   (note-name->german-string p))

#(define (DMSV n)
   ;; n=0: "Dur-"
   ;; n=1: Moll
   ;; n=2: Sept
   ;; n=3: Dim
   (cond
    ( (= n 0) "")
    ((= n 1) "m")
    ((= n 2) "7")
    ((= n 3) "o")
    ))

#(define (ChordName->markup p n)
   (let* ((m (- n 2))
          (bname (string-downcase (get-Name p)))
          (cname (string-capitalize bname))
          (i (get-Index p))
          (terz (get-Name (list-ref Terz-circle i)))
          (simple
           (cond
            ((>= n 2)
             bname)
            ((= n 1)
             cname)
            (else terz)
            ))
          (hoch
           (cond
            ((>= n 3) (DMSV m))
            (else ""))))
     (make-concat-markup
      (list
       (make-simple-markup simple)
       (make-smaller-markup
        (make-raise-markup 0.6 (make-simple-markup hoch)))))))

rowDist=#(define-scheme-function (parser location dist)
           (number?)
           (set! row-dist dist))

colDist=#(define-scheme-function (parser location dist)
           (number?)
           (set! col-dist dist))

slope=#(define-scheme-function (parser location dist)
         (number?)
         (set! h-shift dist))

#(define-markup-command (draw-acc-bass layout props)()
   #:properties ((font-size 0) (thickness 2.5) (offset 3.5))
   (let* ((my-circle (make-circle-stencil dm-circle 0.1 #f))
          ; (cir-dist (+ (* 2 dm-circle) xdist)) ;; dist: how much distance between two cirles
          (thick (* (magstep font-size) (ly:output-def-lookup layout 'line-thickness)))
          (underline-thick (* thickness thick))
          (y (* thick (- offset)))
          )
     ;procedure body
     (apply ly:stencil-add
       empty-stencil
       (map
        (lambda (z)
          (ly:stencil-translate
           (apply ly:stencil-add
             empty-stencil
             (map
              (lambda (x)
                (let* ((m
                        (interpret-markup layout props
                          (ChordName->markup (list-ref Q-circle x) z)))
                       (myx  (ly:stencil-extent m X))
                       (xstart (car myx))
                       (xend (cdr myx))
                       (breite (- xend xstart))
                       (myy  (ly:stencil-extent m Y))
                       (hoch (- (cdr myy) (car myy))))
                  (ly:stencil-translate-axis
                   (ly:stencil-add
                    (ly:stencil-translate-axis
                     (ly:stencil-translate-axis
                      (ly:stencil-add
                       (if (= 0 z)
                           (make-line-stencil underline-thick xstart y xend y)
                           empty-stencil)
                       m)
                      (- 0 (/ breite 2)) X)
                     (- 0 (/ hoch 2)) Y) ;; chordname plus underline if terzbass
                    my-circle) ;; circled chordname
                   (* x col-dist) X)))
              (iota 20 0)))
           (cons (* z h-shift) (* z col-dist (* row-dist -1)))))
        (iota 6)))))


\bookpart {
  \rowDist #1
  \colDist #(+ dm-circle dm-circle 0.2)
  \slope #dm-circle
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with standard distances"
      \vspace #2 \translate #'(0 . 0 ) \scale #'(0.75 . 0.75) \draw-acc-bass
    }
  }
}

\bookpart {
  \rowDist #0.8
  \colDist #(+ dm-circle dm-circle -1)
  \slope  #(* -0.5 dm-circle)
  \markup {
    \column  {
      \vspace #1 "Draw an Accordion Stradella Bass with some funny distances"
      \vspace #2 \translate #'(10 . 0 ) \scale #'(0.9 . 0.9) \draw-acc-bass
    }
  }
}

harm6

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #7 am: Sonntag, 28. August 2016, 21:13 »
Hallo Manuela,

ich schrieb früher schon:
Generell ist das destruktive neu setzen einer Variable durchaus mit Vorsicht zu geniessen...
Denn es funktioiniert nicht immer.

In diesem Fall scheint es so zu sein, daß das markup-command die neu gesetzten Werte erst zu sehen bekommt nachdem der LilyPond-parser sie endgültig zugeordnet hat, im Unterschied zu Funktionen. Betrachte:
%% markup-command

#(define-markup-command (tst layout props)()
  (write-me "foo:\t" foo)
  empty-stencil)
 
#(define foo 1)
\markup \tst

#(set! foo 1.1)
\markup \tst

%% music-function

testII =
#(define-music-function (parser location)()
  (write-me "testII-bla:\t" bla)
  #{#})
 
#(define bla 2)
\testII

#(set! bla 2.1)
\testII
Auch im log sieht man, daß die Anzeige im markup-command viel später erscheint als die der Funktion.

Darüber hinaus ist das setzen von top-level-Variablen und späterem reset auch nicht LilyPondisch.

Für sowas benutzt man context-, grob-, markup-properties oder optionale Argumente.

Auch ist ein markup-command ohne Argumente immer befremdlich, imho

Verwende doch define-scheme-function, da kannst Du auch optionale Argumente unterbringen, zumindest in beschränktem Umfang.

Gruß,
  Harm

Manuela

  • Member
Re: Neues Code Snippet (mit einem kleinen Problem)
« Antwort #8 am: Dienstag, 30. August 2016, 14:32 »
Ich habe das Snippet jetzt umgeschrieben. Es werden internationale Bezeichnungen verwendet, außerdem kann ein Button durch Angabe von Zeilen- und Spaltennummer eingefärbt werden. Ursprünglich wollte ich eine Tonhöhe für die Spaltennummer verwenden, aber ich kriege es nicht gebacken, der Markup-Funktion einen Pitch als Parameter zu übergeben (mit define-scheme-music funktioniert es).

\version "2.18.0"
\language "deutsch"

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Drawing a standard Stradella Accordion Bass
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% pitch+music functions and definitions
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define (pitch-equals? p1 p2)
   (and
    (= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
    (= (ly:pitch-notename p1) (ly:pitch-notename p2))))

#(define (note-name->string pitch)
   (let* ((a (ly:pitch-alteration pitch))
          (n (ly:pitch-notename pitch)))
     (make-concat-markup
      (list
       (make-simple-markup
        (vector-ref #("C" "D" "E" "F" "G" "A" "B") n))
       (if (= a 0)
           (make-line-markup (list empty-markup))
           (make-line-markup
            (list
             (alteration->text-accidental-markup a)
             (make-hspace-markup 0.1))))))))

#(define (DMSV n)
   (cond
    ((= n 2) "M")
    ((= n 3) "m")
    ((= n 4) "7")
    ((= n 5) "o")
    (else "")))

#(define (ChordName->markup p n)
   (let* ((i (get-Index p))
          (terz (note-name->string (list-ref Terz-circle i)))
          (bas (note-name->string (list-ref Q-circle i)))
          (simple
           (if (= n 0) terz bas)))
     (make-concat-markup
      (list
       simple
       (make-smaller-markup
        (make-raise-markup 0.6 (make-simple-markup (DMSV n))))))))

#(define Q-circle ;; define circle of fifths as pitchlist
   (list
    (ly:make-pitch 0 6 DOUBLE-FLAT) ;; heses
    (ly:make-pitch 0 3 FLAT)        ;; fes
    (ly:make-pitch 0 0 FLAT)        ;; ces
    (ly:make-pitch 0 4 FLAT)        ;; ges
    (ly:make-pitch 0 1 FLAT)        ;; des
    (ly:make-pitch 0 5 FLAT)        ;; as
    (ly:make-pitch 0 2 FLAT)        ;; es
    (ly:make-pitch 0 6 FLAT)        ;; b
    (ly:make-pitch 0 3 0)           ;; f
    (ly:make-pitch 0 0 0)           ;; c
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    (ly:make-pitch 0 5 0)           ;; a
    (ly:make-pitch 0 2 0)           ;; e
    (ly:make-pitch 0 6 0)           ;; h
    (ly:make-pitch 0 3 SHARP)       ;; fis
    (ly:make-pitch 0 0 SHARP)       ;; cis
    (ly:make-pitch 0 4 SHARP)       ;; gis
    (ly:make-pitch 0 1 SHARP)       ;; dis
    (ly:make-pitch 0 5 SHARP)       ;; ais
    ))

#(define Terz-circle ;; define terzbasses
   (list
    (ly:make-pitch 0 1 FLAT)        ;; des
    (ly:make-pitch 0 5 FLAT)        ;; as
    (ly:make-pitch 0 2 FLAT)        ;; es
    (ly:make-pitch 0 6 FLAT)        ;; b
    (ly:make-pitch 0 3 0)           ;; f
    (ly:make-pitch 0 0 0)           ;; c
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    (ly:make-pitch 0 5 0)           ;; a
    (ly:make-pitch 0 2 0)           ;; e
    (ly:make-pitch 0 6 0)           ;; h
    (ly:make-pitch 0 3 SHARP)       ;; fis
    (ly:make-pitch 0 0 SHARP)       ;; cis
    (ly:make-pitch 0 4 SHARP)       ;; gis
    (ly:make-pitch 0 1 SHARP)       ;; dis
    (ly:make-pitch 0 5 SHARP)       ;; ais
    (ly:make-pitch 0 2 SHARP)       ;; eis
    (ly:make-pitch 0 6 SHARP)       ;; his
    (ly:make-pitch 0 4 0)           ;; g
    (ly:make-pitch 0 1 0)           ;; d
    ))

#(define (get-Index p)
   (list-index (lambda(x)(pitch-equals? x p)) Q-circle))

#(define-markup-command (accordion-bass layout props i1 n)
   (index? index? )
   ;; mark pitch p in row n with different color
   #:properties ((font-size 0) (thickness 2.5) (offset 3.5)(circle-padding 0.2))
   (let* ((myA (interpret-markup layout props
                 (make-concat-markup
                  (list
                   (make-simple-markup "ges")
                   (make-smaller-markup
                    (make-raise-markup 0.6 (make-simple-markup "m")))))))
          (ces7-xt ( ly:stencil-extent myA X))
          (ces7-x (- (cdr ces7-xt) (car ces7-xt)))
          (pad (* (magstep font-size) circle-padding 2))
          (dm-circle (+ (/ ces7-x 2) pad)) ;; don'tm mess radius with diameter!
          (col-dist (+ (* 2 dm-circle) pad))
          (row-dist 0.9)
          (h-shift (+ dm-circle 0))
          (thick (* (magstep font-size) (ly:output-def-lookup layout 'line-thickness)))
          (underline-thick (* thickness thick))
          (my-circle (make-circle-stencil dm-circle thick #f))
          (y (* thick (- offset)))
          (a1 (- 6 n)))
     (apply ly:stencil-add
       empty-stencil
       (map
        (lambda (z)
          (let ((zz z))
            (ly:stencil-translate
             (apply ly:stencil-add
               empty-stencil
               (map
                (lambda (x)
                  (let* ((m (interpret-markup layout props
                              (ChordName->markup (list-ref Q-circle x) z)))
                         (myx  (ly:stencil-extent m X))
                         (xstart (car myx))
                         (xend (cdr myx))
                         (breite (- xend xstart))
                         (myy  (ly:stencil-extent m Y))
                         (hoch (- (cdr myy) (car myy))))
                    (ly:stencil-translate-axis
                     (ly:stencil-add
                      (if (and (= 1 z)(= 9 x))  ;; mark C-Button
                          (ly:stencil-add
                           (ly:stencil-in-color (make-circle-stencil dm-circle 0 #t)
                             1 1 1)
                           (make-circle-stencil (- dm-circle (* 5 thick)) (* 5 thick) #f))
                          empty-stencil)
                      (if (and (= 1 z)(or (= 5 x)(= 13 x))) ;; mark As- and E-Buttons
                          (ly:stencil-add
                           (ly:stencil-in-color (make-circle-stencil dm-circle 0 #t)
                             1 1 1)
                           (make-circle-stencil (- dm-circle (* 5 thick)) (* 2.5 thick) #f))
                          empty-stencil)
                      (if (and (= a1 z)(= i1 x))  ;; mark p Button
                          (ly:stencil-in-color (make-circle-stencil dm-circle 0 #t)
                            0.9 1 0.9)
                          empty-stencil)
                      (ly:stencil-translate-axis
                       (ly:stencil-translate-axis
                        (ly:stencil-add
                         (if (= 0 zz)
                             (make-line-stencil underline-thick xstart y xend y)
                             empty-stencil)
                         m)
                        (- 0 (/ breite 2)) X)
                       (- 0 (/ hoch 2)) Y) ;; chordname plus underline if terzbass
                      my-circle) ;; circled chordname
                     (* x col-dist) X)))
                (iota 20 0)))
             (cons (* zz h-shift) (* zz col-dist (* row-dist -1))))))
        (iota 6)))))
\markup \column {
  \line { "Draw a standard Accordion bass system using Markup-funcions of Lilypond" }
  \line { "the Buttons A" \flat ", C and E are marked" }
  \line { "mark a button in a different color by entering its row and column number" }
  \line { "first number: column (0=B" \hspace #-0.5 \super \fontsize #1 \doubleflat ", 19=A" \hspace #-0.5 \super \sharp ")" }
  \line { "second number: row (1=diminished chords, 6=terz basses)" }
  \line { "if the parameters are outside this range no button is colored" }
  \line { "change the scale factor to a number you like" }
  \line { "usage:" \bold " \markup \scale #'(0.75 . 0.75) \accordion-bass #4 #2" }
  \line { " " }
}
\markup \scale #'(0.75 . 0.75) \accordion-bass #4 #2
« Letzte Änderung: Dienstag, 30. August 2016, 17:49 von Manuela »

ingmar

  • Member
Akkordeon
« Antwort #9 am: Dienstag, 30. August 2016, 18:11 »
hallo - könntest du dem Thread noch einen sinnvollen Namen geben? Danke!

--ingmar

Manuela

  • Member
Re: Neues Code Snippet - Akkordeon Standard Stradella Basssystem zeichnen
« Antwort #10 am: Dienstag, 30. August 2016, 22:28 »
erledigt  :)

harm6

  • Member
Re: Neues Code Snippet - Akkordeon Standard Stradella Basssystem zeichnen
« Antwort #11 am: Mittwoch, 31. August 2016, 00:32 »
Hallo Manuela,

ich kenn mich mit dem Instrument zwar überhaupt nicht aus, hier aber ein paar Bemerkungen.

Falls "internationale Bezeichnungen", warum \language "deutsch"?

Farben seh' ich nicht...

pitches in markup:
#(define-markup-command (tst layout props pitch)(ly:pitch?)
  (write pitch)
  empty-stencil)
 
\markup \tst ##{ c #}

Zum code:

pitch-equals? kann man hier vereinfachen:
#(define (pitch-equals? p1 p2)
  ;; doesn't work for quarter-tones
  (= (ly:pitch-semitones p1) (ly:pitch-semitones p2)))

Für DMSV besser:
#(define (DMSV n)
   (case n
    ((2) "M")
    ((3) "m")
    ((4) "7")
    ((5) "o")
    (else "")))

Warum diese langen Listen für Q-circle und Terz-circle? Geht nicht auch?
#(define Q-circle ;; define circle of fifths as pitchlist
  (event-chord-pitches
    #{ heses fes ces ges des as es b f c g d a e h fis cis gis dis ais #}))

#(define Terz-circle ;; define terzbasses
  (map (lambda (pitch) (ly:pitch-transpose #{ e' #} pitch)) Q-circle))

Hier hab ich erst mal aufgehört denn das nachfolgende ist völlig unklar:
Zitat
#(define-markup-command (accordion-bass layout props i1 n)
was ist i1?
   (index? index? )
   ;; mark pitch p in row n with different color
pitch p? Was für ein pitch p? p ist hier im ganzen code keine Variable
   #:properties ((font-size 0) (thickness 2.5) (offset 3.5)(circle-padding 0.2))
 Hier sollte ein doc-string stehen
   warum myA? was ist A?
   (let* ((myA (interpret-markup layout props
                 (make-concat-markup
                  (list
                   (make-simple-markup "ges") warum hier ges?
                   (make-smaller-markup
                    (make-raise-markup 0.6 (make-simple-markup "m")))))))
          aber hier ces7
          (ces7-xt ( ly:stencil-extent myA X))
          (ces7-x (- (cdr ces7-xt) (car ces7-xt)))

Das ganze soll ja ins LSR, insofern solltest Du dafür Sorge tragen es potenziellen Interessenten/Nutzern Deiner snippets leicht zu machen, Deinen Gedanken zu folgen. Bitte sorge für Klarheit im Code sowie verständliche Kommentare (zahlreiche Kommentare).
Generell ist es üblich ausschließlich kleine Buchstaben für Namen zu verwenden. Wenn ich große lese wie in DMSV, (was soll das eigentlich heißen? Mit anderen Worten DOCME !) dann erwarte ich eigentlich etwas ganz besonderes ...

Gruß,
  Harm



Manuela

  • Member
Re: Neues Code Snippet - Akkordeon Standard Stradella Basssystem zeichnen
« Antwort #12 am: Mittwoch, 31. August 2016, 17:37 »
Ich habe den Code nochmals ausführlich überarbeitet und mit Kommentaren versehen. Ich denke, ich lasse es jetzt genug sein  :-[

\version "2.18.0"

\language "deutsch"

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Drawing a standard Stradella Accordion Bass
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define cycle-of-fifths ;; define circle of fifths as pitchlist
   (event-chord-pitches
    #{ heses' fes' ces' ges' des' as' es' b' f' c' g' d' a' e' h' fis' cis' gis' dis' ais' #}))

#(define Terz-circle ;; define counter bass notes as pitchlist
   (event-chord-pitches
    #{ des' as' es' b' f' c' g' d' a' e' h' fis' cis' gis' dis' ais' eis' his' g' d' #}))

%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% pitch+music functions and definitions
%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

#(define (pitch-equals? p1 p2)
   (and
    (= (ly:pitch-alteration p1) (ly:pitch-alteration p2))
    (= (ly:pitch-notename p1) (ly:pitch-notename p2))))

#(define (note-name->string pitch)
   (let* ((a (ly:pitch-alteration pitch))
          (n (ly:pitch-notename pitch)))
     (make-concat-markup
      (list
       (make-simple-markup
        (vector-ref #("C" "D" "E" "F" "G" "A" "B") n))
       (if (= a 0)
           (make-line-markup (list empty-markup))
           (make-line-markup
            (list
             (alteration->text-accidental-markup a)
             (make-hspace-markup 0.1))))))))

#(define (chord-superscript n)
   ;; get the superscript for row n
   ;; counter bass notes and root notes have no superscript
   (cond
    ((= n 2) "M")
    ((= n 3) "m")
    ((= n 4) "7")
    ((= n 5) "o")
    (else "")))

#(define (ChordName->markup p n)
   ;; make the name from a chord with pitch p in row n
   ;; you get an error when the pitch is not in the circle of fifths
   (let* ((i (get-Index p))
          (terz (note-name->string (list-ref Terz-circle i)))
          (bas (note-name->string (list-ref cycle-of-fifths i)))
          ;; root name of the button
          (simple
           (if (= n 0) terz bas)))
     (make-concat-markup
      (list
       simple
       (make-smaller-markup
        (make-raise-markup 0.6 (make-simple-markup (chord-superscript n))))))))

#(define (get-Index p)
   ;; get the index of a pitch p in the circle of fifths
   ;; this number is needed to create the labels of the bass buttons
   (list-index (lambda(x)(pitch-equals? x p)) cycle-of-fifths))

#(define-markup-command (accordion-bass layout props i-col i-row)
   (index? index? )
   ;; draw a standard stradella accordion bass with 120 buttons
   ;; mark the button in column i-col and i-row in a different color
   ;; column 0: B doubleflat, col 9: C, col 19: A#
   ;; the rows: 1=diminished chord, 2=7th chord,
   ;;           3=minor chord, 4=major chord, 5=root note, 6=counter bass note

   #:properties ((font-size 0) (thickness 2.5) (offset 3.5)(circle-padding 0.2))
   (let* ((Bbb (interpret-markup layout props
                 ;; this should be the largest circle diameter needed for button labels
                 ;; checking out the horizontal extent of B DOUBLEFLAT sup M
                 (make-concat-markup
                  (list
                   (make-simple-markup "B")
                   (make-musicglyph-markup
                    "accidentals.flatflat")
                   (make-smaller-markup
                    (make-raise-markup 0.6 (make-simple-markup "M")))))))
          (Bbb-xt ( ly:stencil-extent Bbb X))
          (Bbb-x (- (cdr Bbb-xt) (car Bbb-xt)))
          ;; calculating padding from circle-padding
          (pad (* (magstep font-size) circle-padding 2))
          ;; adding pad to extent of widest button label
          (dm-circle (+ (/ Bbb-x 2) pad)) ;; don'tm mess radius with diameter!
          (col-dist (+ (* 2 dm-circle) pad)) ;; distance between two buttons in a row
          (row-dist 0.95) ;; you can vary the distance between the button rows
          (h-shift (+ dm-circle pad)) ;; horizontal shifting of the botton rows
          (thick (* (magstep font-size) (ly:output-def-lookup layout 'line-thickness)))
          (underline-thick (* thickness thick))
          (my-circle (make-circle-stencil dm-circle thick #f))
          ;; needed for underline
          (y (* thick (- offset)))
          (a1 (- 6 i-row)))
     (apply ly:stencil-add
       empty-stencil
       (map
        (lambda (z)
          (ly:stencil-translate
           (apply ly:stencil-add
             empty-stencil
             (map
              (lambda (x)
                (let* ((m (interpret-markup layout props
                            (ChordName->markup (list-ref cycle-of-fifths x) z)))
                       (myx  (ly:stencil-extent m X))
                       (xstart (car myx))
                       (xend (cdr myx))
                       (breite (- xend xstart))
                       (myy  (ly:stencil-extent m Y))
                       (hoch (- (cdr myy) (car myy))))
                  (ly:stencil-translate-axis
                   (ly:stencil-add
                    ;; mark C-Button
                    (if (and (= 1 z)(= 9 x))
                        (ly:stencil-add
                         (ly:stencil-in-color (make-circle-stencil dm-circle 0 #t)
                           1 1 1)
                         (make-circle-stencil (- dm-circle (* 5 thick)) (* 5 thick) #f))
                        empty-stencil)
                    ;; mark Ab- and E-Buttons
                    (if (and (= 1 z)(or (= 5 x)(= 13 x)))
                        (ly:stencil-add
                         (ly:stencil-in-color (make-circle-stencil dm-circle 0 #t)
                           1 1 1)
                         (make-circle-stencil (- dm-circle (* 5 thick)) (* 2.5 thick) #f))
                        empty-stencil)
                    ;; mark Button in col i-col and row i-row
                    ;; (some calculation is done because we draw row 6 first
                    ;;and work our way upwards)
                    (if (and (= a1 z)(= i-col x))
                        (ly:stencil-in-color (make-circle-stencil dm-circle 0 #t)
                          0.9 1 0.9) ;; a light green color
                        empty-stencil)
                    ;; this is our chord name as button label
                    ;; underlined if counter bass note
                    (ly:stencil-translate-axis
                     (ly:stencil-translate-axis
                      (ly:stencil-add
                       (if (= 0 z)
                           (make-line-stencil underline-thick xstart y xend y)
                           empty-stencil)
                       m)
                      (- 0 (/ breite 2)) X)
                     (- 0 (/ hoch 2)) Y)
                    ;; this is the button
                    my-circle)
                   (* x col-dist) X)))
              ;; loop through all columns
              (iota 20 0)))
           ;; calculate horizontal and vertical shift relative to the leftmost button
           ;; in the row with the diminished chords
           (cons (* z h-shift) (* z col-dist (* row-dist -1)))))
        ;; loop through all rows
        (iota 6)))))

\markup \column {
  \line { \vspace #2 }
  \line { "Draw a standard Accordion bass system using Markup-funcions of Lilypond" }
  \line { "the Buttons A" \flat ", C and E are marked" }
  \line { "mark a button in a different color by entering its row and column number" }
  \line { \underline "first number:" "column (0=B" \hspace #-0.5 \super \fontsize #1 \doubleflat ", 19=A" \hspace #-0.5 \super \sharp ")" }
  \line { \underline "second number:" "row (1=diminished chord, 2=7th chord, " }
  \line { "3=minor chord, 4=major chord, 5=root note, 6=counter bass note)" }
  \line { "if the parameters are outside this range no button is colored" }
  \line { "change the scale factor to a number you like" }
  \line { "usage:" \bold " \markup \scale #'(0.75 . 0.75) \accordion-bass #4 #2" }
  \line { \vspace #1 }
}
\markup \scale #'(0.75 . 0.75) \accordion-bass #4 #1

Manuela

  • Member
Re: Neues Code Snippet - Akkordeon Standard Stradella Basssystem zeichnen
« Antwort #13 am: Montag, 5. September 2016, 09:39 »
Harm, würdest du den Code so wie er jetzt ist approven? Oder eher nicht?

harm6

  • Member
Re: Neues Code Snippet - Akkordeon Standard Stradella Basssystem zeichnen
« Antwort #14 am: Mittwoch, 7. September 2016, 11:34 »
Hallo Manuela,

die Anforderung die jedes snippet erfüllen muß ist, daß es macht was es verspricht. Obwohl ich mich mit dem Instrument nicht auskenne, denke ich diese Anforderung ist erfüllt.
Jedoch wünsche ich mir im LSR snippets zu sehen, deren Codierung als Vorbild für Andere dienen können, insoweit reite ich etwas stärker auf Code-Verbesserungen rum, falls der Author auszumachen ist ;)
Ich habe bemerkt, daß Du einige meiner Vorschläge aufgegriffen hast, andere nicht.
Nun will ich Dich weder frustrieren noch demotivieren, aber ich hätte erwartet, daß Du begründest warum Du einen meiner Vorschläge verwirfst: Ich liege ja nicht immer richtig und es mag gute Gründe geben es anders zu machen. Das ist eigentlich der normale Weg auch wenn er manchmal langwierig ist.
Als Beispiel siehe die Diskussion um meine Implementierung von undertie:
https://codereview.appspot.com/270640043
https://sourceforge.net/p/testlilyissues/issues/3088/
Und es gab noch zwei follow-up-patches...

Also folge dem Vorschlag, falls er gut ist, wenn nicht lehne ihn mit Begründung ab.

Nachdem das gesagt ist ...
Ich habe im Moment nicht soviel Zeit wie ich mir wünschte und hab noch nicht wieder intensiv in Deinen letzten Code geschaut. Mein Vorschlag wäre, Du lädst es schon hoch ins LSR, ändern kann man es dann ja immer noch.

Dein snippet zum Quintenzirkel ist international schon auf Interesse und Kritik gestoßen.
http://lilypond.1069038.n5.nabble.com/circle-of-fifths-td194235.html
Das Interesse zeigt, daß dieses snippet sehr wertvoll ist, die Kritik würde ich mir aber auch zu Herzen nehmen ;)


Gruß,
  Harm