So for now I will use this workaround :

\version "2.25.8"

tempoChange =
#(define-music-function (interval endscale thenscale music)
   (ly:duration? scale? (scale? 1) ly:music?)
   "Make a gradual tempo change over @var{music}, essentially changing
speed after
every duration of @var{interval}, approaching a factor of speed of
@var{endscale}
compared to the start.  Afterwards, tempo is switched to @var{thenscale} of the
original speed (default 1).  If @var{thenscale} is 0, the speed reached at the
end is just maintained and can be overriden with an explicit @samp{\\tempo}
command if required."
   (define (scaletempo oldscale newscale)
     (make-apply-context
      (lambda (ctx)
        (set! (ly:context-property ctx 'tempoWholesPerMinute)
              (ly:moment-mul (ly:context-property ctx 'tempoWholesPerMinute)
                             (ly:make-moment (/ newscale oldscale)))))))

   (let* ((muslen (ly:moment-main (ly:music-length music)))
          (intlen (ly:moment-main (ly:duration-length interval)))
          (steps (/ muslen intlen))
          (endfactor (scale->factor endscale))
          (thenfactor (scale->factor thenscale)))
     (make-simultaneous-music
      (list music
            (context-spec-music
             (make-sequential-music
              (let loop ((rsteplst (iota (1+ steps) endfactor (/ (- 1
endfactor) steps)))
                         (res (if (positive? thenfactor)
                                  (list (scaletempo endfactor thenfactor))
                                  (list))))
                (if (null? (cdr rsteplst))
                    res
                    (loop (cdr rsteplst)
                          (cons* (scaletempo (cadr rsteplst) (car rsteplst))
                                 (make-skip-music (ly:make-duration 0 0 intlen))
                                 res)))))
             'Score)))))

music = {
  c'8 d' e' f' g' a' |
  b' c'' b' a' g' f' |
}
structure = {
  \time 6/8
  \tempo 4. = 100
  << \tag #'midiOnly
     \tempoChange 8 1/2 0 {
       s2. |
     }
     s2. |
  >>
}
structureMidi = \structure
structure = \removeWithTag #'midiOnly \structure
scoreContent =   <<
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
  \new Voice << \music \structure >>
>>
\score {
  \scoreContent
  \layout {}
}
\score {
  <<
    \structureMidi
    \scoreContent
  >>
  \midi {}
}

Again, Thanks a lot David.

Le mer. 23 août 2023, à 10 h 15, Pierre-Luc Gauthier
<p.luc.gauth...@gmail.com> a écrit :
>
> M(core dumped)WE pretty please :
>
> tempoChange =
> #(define-music-function (interval endscale thenscale music)
>    (ly:duration? scale? (scale? 1) ly:music?)
>    "Make a gradual tempo change over @var{music}, essentially changing
> speed after
> every duration of @var{interval}, approaching a factor of speed of
> @var{endscale}
> compared to the start.  Afterwards, tempo is switched to @var{thenscale} of 
> the
> original speed (default 1).  If @var{thenscale} is 0, the speed reached at the
> end is just maintained and can be overriden with an explicit @samp{\\tempo}
> command if required."
>    (define (scaletempo oldscale newscale)
>      (make-apply-context
>       (lambda (ctx)
>         (set! (ly:context-property ctx 'tempoWholesPerMinute)
>               (ly:moment-mul (ly:context-property ctx 'tempoWholesPerMinute)
>                              (ly:make-moment (/ newscale oldscale)))))))
>
>    (let* ((muslen (ly:moment-main (ly:music-length music)))
>           (intlen (ly:moment-main (ly:duration-length interval)))
>           (steps (/ muslen intlen))
>           (endfactor (scale->factor endscale))
>           (thenfactor (scale->factor thenscale)))
>      (make-simultaneous-music
>       (list music
>             (context-spec-music
>              (make-sequential-music
>               (let loop ((rsteplst (iota (1+ steps) endfactor (/ (- 1
> endfactor) steps)))
>                          (res (if (positive? thenfactor)
>                                   (list (scaletempo endfactor thenfactor))
>                                   (list))))
>                 (if (null? (cdr rsteplst))
>                     res
>                     (loop (cdr rsteplst)
>                           (cons* (scaletempo (cadr rsteplst) (car rsteplst))
>                                  (make-skip-music (ly:make-duration 0 0 
> intlen))
>                                  res)))))
>              'Score)))))
>
> music = {
>   c'8 d' e' f' g' a' |
>   b' c'' b' a' g' f' |
> }
> structure = {
>   \time 6/8
>   \tempo 4. = 100
>   \tempoChange 8 1/2 0 {
>     s2. |
>   }
> }
> \score {
>   <<
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>     \new Voice << \music \structure >>
>   >>
>   \layout {}
>   \midi {}
> }
>
> Le mer. 23 août 2023, à 10 h 10, Pierre-Luc Gauthier
> <p.luc.gauth...@gmail.com> a écrit :
> >
> > Well, I think my code structure is the problem.
> >
> > The way I create parts is with this part generator this way :
> >
> > #(typicalPart 'piccolo piccolo structure)
> >
> > And for *every* part (instrument) it merges my \structure variable
> > (\mark, \tempo, i.e. what every body in the orchestra needs) with the
> > music of that part {c'''' d'''' e''''}.
> >
> > I think the problem is that the \changeTempo function is getting
> > applied and re-applied at every single part (37ish parts).
> >
> > Le mer. 23 août 2023, à 09 h 59, Pierre-Luc Gauthier
> > <p.luc.gauth...@gmail.com> a écrit :
> > >
> > > Not quite there yet.
> > > Now I get :
> > >
> > > warning: the property 'tempoWholesPerMinute' must be of type 'positive
> > > moment with no grace part', ignoring invalid value '#<Mom
> > > 7234529593268583733/-9097535130079068160>'
> > >
> > > Le mer. 23 août 2023, à 09 h 45, David Kastrup <d...@gnu.org> a écrit :
> > > >
> > > > Pierre-Luc Gauthier <p.luc.gauth...@gmail.com> writes:
> > > >
> > > > > And what do you know :
> > > > >
> > > > > git diff to the rescue.
> > > > > -
> > > > > +\include "articulate.ly"
> > > > > -    <<
> > > > > +   \articulate <<
> > > > >
> > > > > I tried different avenues and \articulate seems to have creeped its
> > > > > way in in this floating point exception core dump…
> > > > >
> > > > > 'No idea why though nor do I need \articulate anyway. closing.
> > > >
> > > > Well, it certainly expands the problem space.  But my own uses also
> > > > employ articulate.ly .  So it will still require something more special
> > > > to trigger problems.
> > > >
> > > > --
> > > > David Kastrup
> > >
> > >
> > >
> > > --
> > > Pierre-Luc Gauthier
> >
> >
> >
> > --
> > Pierre-Luc Gauthier
>
>
>
> --
> Pierre-Luc Gauthier



-- 
Pierre-Luc Gauthier

Reply via email to