[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Slurs inside a beam
From: |
Aaron Hill |
Subject: |
Re: Slurs inside a beam |
Date: |
Sat, 11 Aug 2018 22:32:23 -0700 |
User-agent: |
Roundcube Webmail/1.3.6 |
On 2018-08-11 13:30, David F. wrote:
While we’re on the topic of bending slurs to our will, I’d like for
slurred, beamed eighth notes to have the slur printed below or inside
the beam. This works with a simple ^~ for ties. How might I
accomplish this?
The behavior I am after can also be seen here:
https://hymnary.org/hymn/SS4C1956/page/561
You can always adjust the control points to get the slur to fit within
the notes. However, manually setting control points can be a little
tedious, especially if you have a slur that is almost correct but just
needs a little nudging in the right direction.
This (likely over-engineered) approach allows you to transform an
existing slur by means of scaling, rotation and translation. It
automatically scales and rotates about the center of the slur, which
seemed most natural when I was experimenting with it.
%%%%
\version "2.19.82"
\language "english"
#(define (transform-coords coords scale rotate offset)
(let* ((x-coords (map (lambda (coord) (car coord)) coords))
(y-coords (map (lambda (coord) (cdr coord)) coords))
(x-center (/ (+ (apply min x-coords) (apply max x-coords)) 2))
(y-center (/ (+ (apply min y-coords) (apply max y-coords)) 2))
(theta (* rotate (/ PI 180)))
(c (cos theta)) (s (sin theta)))
(map (lambda (coord) (let (
(x (* (- (car coord) x-center) (car scale)))
(y (* (- (cdr coord) y-center) (cdr scale))))
(cons (+ (* x c) (* y (- s)) x-center (car offset))
(+ (* x s) (* y c) y-center (cdr offset))))) coords)))
#(define ((transform-slur scale rotate offset) grob)
(let ((coords (ly:slur::calc-control-points grob)))
(transform-coords coords scale rotate offset)))
transformSlur =
#(define-music-function (parser location scale rotate offset)
(pair? number? pair?)
#{ \once \override Slur.control-points =
#(transform-slur scale rotate offset) #})
\new Staff \with { beamExceptions = #'() } << {
e'8 ( a'8 )
\transformSlur #'(0.6 . 0.8) #15 #'(-0.3 . -2.6)
e'8 ^( a'8 )
\tuplet 3/2 { b'8 ( a'8 ) f'8 }
\tuplet 3/2 {
\transformSlur #'(0.5 . 0.6) #180 #'(0.4 . 2)
b'8 _( a'8 )f'8 }
} >>
%%%%
NOTE: Purely for the sake of demonstrating rotation, the second slur is
a "down" slur that I have flipped over.
-- Aaron Hill
slurstem.cropped.png
Description: PNG image