lilypond-user-fr
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Scordatura


From: Martial R
Subject: Re: Scordatura
Date: Sat, 4 Jun 2022 20:25:09 +0200

Merci bcp
je teste :-)

Le sam. 4 juin 2022 à 19:33, Jean Abou Samra <jean@abou-samra.fr> a écrit :
>
> Bonjour Martial,
>
> Suite à ta question à la fondue Lily en visio tout à l'heure,
> je propose une solution pour obtenir un rendu MIDI adapté à
> la scordatura :
>
>
>
> \version "2.23.9"
>
> #(set-object-property! 'scordaturaTuning 'translation-type? list?)
>
> %% Converted from articulations.cc
> #(use-modules (ice-9 match))
> #(define (articulation-list note-events articulation-events type)
>     (let loop ((note-events note-events)
>                (articulation-events articulation-events)
>                (acc '()))
>       (match note-events
>         (()
>          (reverse! acc))
>         ((note-event . rest)
>          (let ((found (find (lambda (ev)
>                               (memq type (ly:event-property ev 'class)))
>                             (ly:event-property note-event 'articulations))))
>            (cond
>             (found
>              (loop rest
>                    articulation-events
>                    (cons found acc)))
>             ((pair? articulation-events)
>              (loop rest
>                    (cdr articulation-events)
>                    (cons (car articulation-events)
>                          acc)))
>             (else
>              (loop rest
>                    '()
>                    (cons '() acc)))))))))
>
>
> #(define (Scordaturize_performer context)
>     (let ((note-evs '())
>           (string-number-evs '())
>           (fingering-evs '()))
>       (make-performer
>        (listeners
>         ((note-event engraver event)
>          (set! note-evs (cons event note-evs)))
>         ((string-number-event engraver event)
>          (set! string-number-evs (cons event string-number-evs)))
>         ((fingering-event engraver event)
>          (set! fingering-evs (cons event fingering-evs))))
>        ((pre-process-music engraver)
>         (let* ((tab-strings (articulation-list note-evs
> string-number-evs 'string-number-event))
>                (defined-fingers (articulation-list note-evs
> fingering-evs 'fingering-event))
>                (func (ly:context-property context 'noteToFretFunction))
>                (string-fret-finger (func context note-evs (list
> tab-strings defined-fingers)))
>                (scordatura-tuning (ly:context-property context
> 'scordaturaTuning)))
>           (for-each
>            (lambda (ev elems)
>              (match-let*
>                    (((string-number fret-number _) elems)
>                     (tuning-base (list-ref scordatura-tuning (1-
> string-number)))
>
>                     ;; Don't care about enharmony, it's about MIDI.
>                     (fret-diff (ly:make-pitch 0 0 (* 1/2 fret-number)))
>                     (sounding-pitch (ly:pitch-transpose tuning-base
> fret-diff)))
>                (ly:event-set-property! ev 'pitch sounding-pitch)))
>            note-evs
>            string-fret-finger)))
>        ((stop-translation-timestep engraver)
>         (set! note-evs '())
>         (set! string-number-evs '())
>         (set! fingering-evs '())))))
>
> \midi {
>    \context {
>      \Voice
>      \consists #Scordaturize_performer
>      noteToFretFunction = #determine-frets
>      predefinedDiagramTable = ##f
>      stringTunings = #guitar-tuning
>    }
> }
>
> mus = {
>    \clef bass
>    e, fis, a, b, d e g a b cis' e' fis'
>    a,\6
> }
>
> \score {
>    \new Staff \with {
>      scordaturaTuning = \stringTuning <e fis b e' b' e''>
>    } \mus
>    \midi { }
>    \layout { }
> }
>
> \new TabStaff \mus
>
>
> Cordialement,
> Jean
>


-- 
Martial Rameaux



reply via email to

[Prev in Thread] Current Thread [Next in Thread]