Re: rall. autocalculation function in Scheme
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 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 >> >
Re: rall. autocalculation function in Scheme
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 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 > 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 '# > 7234529593268583733/-9097535130079068160>' > > > > Le mer. 23 août 2023, à 09 h 45, David Kastrup a écrit : > > > > > > Pierre-Luc Gauthier 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
Re: rall. autocalculation function in Scheme
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 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 '# 7234529593268583733/-9097535130079068160>' > > Le mer. 23 août 2023, à 09 h 45, David Kastrup a écrit : > > > > Pierre-Luc Gauthier 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
Re: rall. autocalculation function in Scheme
Not quite there yet. Now I get : warning: the property 'tempoWholesPerMinute' must be of type 'positive moment with no grace part', ignoring invalid value '#' Le mer. 23 août 2023, à 09 h 45, David Kastrup a écrit : > > Pierre-Luc Gauthier 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
Re: rall. autocalculation function in Scheme
Pierre-Luc Gauthier 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
Re: rall. autocalculation function in Scheme
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. > > > No MWE for now but will provide if needed. > > Can you think of a case where it wouldn't be needed? > Silly me :-) So, \tempoChange works as expected. Sorry for the noise. Thanks David ! -- Pierre-Luc Gauthier
Re: rall. autocalculation function in Scheme
> > No MWE for now but will provide if needed. > Can you think of a case where it wouldn't be needed? Silly me :-) \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 \tempoChange 8 64/128 0 { s2. | } } \score { \new Voice << \music \structure >> \layout {} \midi {} } But, as you could expect, it works flawlessly (Thus the need for a MnWE). Scaling down this sketchy-arachnid code (full symphonic+chorus) of mine will take some time though, but, I _will_ survive. -- Pierre-Luc Gauthier
Re: rall. autocalculation function in Scheme
Pierre-Luc Gauthier writes: > I'm not quite sure how to use it correctly yet but I suppose a typical > usage would be : > > \time 6/8 % btw > > \tempoChange 8 1/2 0 { > \skip 2.*4 | > } > > ^ I.e. : To slow down every 8th during 2.*4 to reach (and keep (0)) a > tempo half the speed it was. > > I get inconsistent results either : > - working correctly > - Hanging forever after [8][16][24][32][40][48][56]… > - Or (with 2.25.8) : > MIDI output to `output.mid'...[1]1213296 floating point > exception (core dumped) > >> it has worked for at least a year or so here. > > No MWE for now but will provide if needed. Can you think of a case where it wouldn't be needed? -- David Kastrup
Re: rall. autocalculation function in Scheme
I'm not quite sure how to use it correctly yet but I suppose a typical usage would be : \time 6/8 % btw \tempoChange 8 1/2 0 { \skip 2.*4 | } ^ I.e. : To slow down every 8th during 2.*4 to reach (and keep (0)) a tempo half the speed it was. I get inconsistent results either : - working correctly - Hanging forever after [8][16][24][32][40][48][56]… - Or (with 2.25.8) : MIDI output to `output.mid'...[1]1213296 floating point exception (core dumped) > it has worked for at least a year or so here. No MWE for now but will provide if needed. -- Pierre-Luc Gauthier
Re: rall. autocalculation function in Scheme
"Adam M. Griggs" writes: > Thank you David. Your code is well above my level for now, but it'll > be great study material. Is it for 2.25.x? I haven't quite got it > working yet, but that's probably my fault. No, it has worked for at least a year or so here. Probably the usage example is less than clear since it works with \keepWithTag for differentiating between layout and midi use. -- David Kastrup
Re: rall. autocalculation function in Scheme
Thank you David. Your code is well above my level for now, but it'll be great study material. Is it for 2.25.x? I haven't quite got it working yet, but that's probably my fault. On Mon, 6 Feb 2023 at 23:24, David Kastrup wrote: > "Adam M. Griggs" writes: > > > Hello list, > > > > I'm trying to create a Scheme function that will automatically calculate > > and enact a *rall*. as a sequence of \tempo assignments. I am aware of > the > > basic *rall*., *rit*., and *accel*. functions in "articulate.ly" but I > > wanted something I have a little more control over. > > What I am using is > > 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) > > > Here are some usages in a time track: > > \tag layout { > \tempo "rall" > \skip 1*2 | > } > \tag midi { > \tempoChange 4 2/3 { > \skip 1. > } > \tag countin \skip 2 > } > > \tag layout { > \tempo "rit." > \skip 2 | > \skip 1*2 | > } > \tag midi { > \tempoChange 8 ##e0.5 0 { > \skip 2 | > \skip 1*2 | > } > } > > Note that ##e0.5 is the same as #1/2 or #5/10 , namely an exact > rational, but written with decimal notation. That can be handy for > fine-tuning since incrementally tweaking decimal notation tends to be > more hands-on than tweaking fraction notation. > > > -- > David Kastrup >
Re: rall. autocalculation function in Scheme
"Adam M. Griggs" writes: > Hello list, > > I'm trying to create a Scheme function that will automatically calculate > and enact a *rall*. as a sequence of \tempo assignments. I am aware of the > basic *rall*., *rit*., and *accel*. functions in "articulate.ly" but I > wanted something I have a little more control over. What I am using is 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) Here are some usages in a time track: \tag layout { \tempo "rall" \skip 1*2 | } \tag midi { \tempoChange 4 2/3 { \skip 1. } \tag countin \skip 2 } \tag layout { \tempo "rit." \skip 2 | \skip 1*2 | } \tag midi { \tempoChange 8 ##e0.5 0 { \skip 2 | \skip 1*2 | } } Note that ##e0.5 is the same as #1/2 or #5/10 , namely an exact rational, but written with decimal notation. That can be handy for fine-tuning since incrementally tweaking decimal notation tends to be more hands-on than tweaking fraction notation. -- David Kastrup
Re: rall. autocalculation function in Scheme
Thank you Valentin. This is great. Works perfectly and also instructive for a relative newbie to Scheme. On Mon, 6 Feb 2023 at 16:49, Valentin Petzel wrote: > Hello Adam, > > Using #{ ... #} does not magically register the music or something. A > scheme > expression such as (begin ...) will evaluate to the last statement. So > > (begin #{ ... #} (enact-tempo-decrease ...)) > > will simply evaluate to the second part, thus always to #{#}. > > What you do in fact need to do is to gather the music created thus into a > list, most cleanly by using a separate recursion function (so > (define-music- > function (...) (...) (define (rec steps) ...) #{ #@(rec steps) #} )) or by > using > > (make-music 'SequentialMusic 'elements (cons #{ ... #} (ly:music-property > (enact-tempo-decrease ...) 'elements)) > > But as I already said in my previous response you can do this easier using > map. > > With regards to that version: To handle negative values simply add a > filter > call: > > myRall = > #(define-music-function > (steps duration) > (integer? ly:duration?) > (let* ((tempi-list (iota steps 100 -1)) > (tempi-list (filter (lambda (x) (> x 0)) tempi-list)) > (tempi-mus (map (lambda (t) #{ \tempo 4 = $t s$duration #}) tempi- > list))) > #{ #@tempi-mus #})) > > Cheers, > Valentin > > Am Montag, 6. Februar 2023, 07:50:02 CET schrieb Adam M. Griggs: > > I've given it some more work. The \repeat construct is gone, and the > > displayed messages indicate that my recursion is working correctly. > > > > Metronome marks are not yet printed, however. What am I missing? Also, > I'm > > getting a wrong type argument error message when I try to (let* > > (current-tempo (car tempo-list))). I feel like I'm almost there though. > > > > Code attached, and thanks again. > > > > On Mon, 6 Feb 2023 at 14:19, Adam M. Griggs > wrote: > > > Hello list, > > > > > > I'm trying to create a Scheme function that will automatically > calculate > > > and enact a *rall*. as a sequence of \tempo assignments. I am aware of > > > the basic *rall*., *rit*., and *accel*. functions in "articulate.ly" > but > > > I wanted something I have a little more control over. > > > > > > I need help, and I don't know if it's just in the implementation > details > > > or my overall approach to the problem. > > > > > > For now, it's just a *rall*. The algorithm describing the rate of > > > slowdown is extremely basic but that can be adjusted later. > > > > > > My approach so far has been to create a list of values starting at 100 > > > (let's assume percentages of the initial tempo and work that in later) > and > > > then have them trickle down. Using #(display ...), I see this is > working > > > just fine. > > > > > > Clearly my \repeat call isn't appropriate here and I should replace it > > > with a recursive function call containing just its body (the {\tempo 4 > = > > > ... \skip ...} part). And I'm sure I'm not really going to get anywhere > > > with #@tempi-list but I hope it communicates what I'm aiming for. I've > > > been > > > playing with this for a few hours but I haven't been able to get the > parts > > > to mesh together. I could keep stabbing at it, or ask for help here. > > > > > > Code attached, and thank you! > >
Re: rall. autocalculation function in Scheme
Hello Adam, Using #{ ... #} does not magically register the music or something. A scheme expression such as (begin ...) will evaluate to the last statement. So (begin #{ ... #} (enact-tempo-decrease ...)) will simply evaluate to the second part, thus always to #{#}. What you do in fact need to do is to gather the music created thus into a list, most cleanly by using a separate recursion function (so (define-music- function (...) (...) (define (rec steps) ...) #{ #@(rec steps) #} )) or by using (make-music 'SequentialMusic 'elements (cons #{ ... #} (ly:music-property (enact-tempo-decrease ...) 'elements)) But as I already said in my previous response you can do this easier using map. With regards to that version: To handle negative values simply add a filter call: myRall = #(define-music-function (steps duration) (integer? ly:duration?) (let* ((tempi-list (iota steps 100 -1)) (tempi-list (filter (lambda (x) (> x 0)) tempi-list)) (tempi-mus (map (lambda (t) #{ \tempo 4 = $t s$duration #}) tempi- list))) #{ #@tempi-mus #})) Cheers, Valentin Am Montag, 6. Februar 2023, 07:50:02 CET schrieb Adam M. Griggs: > I've given it some more work. The \repeat construct is gone, and the > displayed messages indicate that my recursion is working correctly. > > Metronome marks are not yet printed, however. What am I missing? Also, I'm > getting a wrong type argument error message when I try to (let* > (current-tempo (car tempo-list))). I feel like I'm almost there though. > > Code attached, and thanks again. > > On Mon, 6 Feb 2023 at 14:19, Adam M. Griggs wrote: > > Hello list, > > > > I'm trying to create a Scheme function that will automatically calculate > > and enact a *rall*. as a sequence of \tempo assignments. I am aware of > > the basic *rall*., *rit*., and *accel*. functions in "articulate.ly" but > > I wanted something I have a little more control over. > > > > I need help, and I don't know if it's just in the implementation details > > or my overall approach to the problem. > > > > For now, it's just a *rall*. The algorithm describing the rate of > > slowdown is extremely basic but that can be adjusted later. > > > > My approach so far has been to create a list of values starting at 100 > > (let's assume percentages of the initial tempo and work that in later) and > > then have them trickle down. Using #(display ...), I see this is working > > just fine. > > > > Clearly my \repeat call isn't appropriate here and I should replace it > > with a recursive function call containing just its body (the {\tempo 4 = > > ... \skip ...} part). And I'm sure I'm not really going to get anywhere > > with #@tempi-list but I hope it communicates what I'm aiming for. I've > > been > > playing with this for a few hours but I haven't been able to get the parts > > to mesh together. I could keep stabbing at it, or ask for help here. > > > > Code attached, and thank you! signature.asc Description: This is a digitally signed message part.
Re: rall. autocalculation function in Scheme
Hello Adam, your problem is that you are feeding the whole list of tempi into each \tempo command. Instead you should do something like myRall = #(define-music-function (steps duration) (integer? ly:duration?) (let* ((tempi-list (iota steps 100 -1)) (tempi-mus (map (lambda (t) #{ \tempo 4 = $t s$duration #}) tempi- list))) #{ #@tempi-mus #})) Instead of creating tempo events you might want to use \applyContext to relatively change tempoWholesPerMinute though. Cheers, Valentin Am Montag, 6. Februar 2023, 06:19:57 CET schrieb Adam M. Griggs: > Hello list, > > I'm trying to create a Scheme function that will automatically calculate > and enact a *rall*. as a sequence of \tempo assignments. I am aware of the > basic *rall*., *rit*., and *accel*. functions in "articulate.ly" but I > wanted something I have a little more control over. > > I need help, and I don't know if it's just in the implementation details or > my overall approach to the problem. > > For now, it's just a *rall*. The algorithm describing the rate of slowdown > is extremely basic but that can be adjusted later. > > My approach so far has been to create a list of values starting at 100 > (let's assume percentages of the initial tempo and work that in later) and > then have them trickle down. Using #(display ...), I see this is working > just fine. > > Clearly my \repeat call isn't appropriate here and I should replace it with > a recursive function call containing just its body (the {\tempo 4 = ... > \skip ...} part). And I'm sure I'm not really going to get anywhere with > #@tempi-list but I hope it communicates what I'm aiming for. I've been > playing with this for a few hours but I haven't been able to get the parts > to mesh together. I could keep stabbing at it, or ask for help here. > > Code attached, and thank you! signature.asc Description: This is a digitally signed message part.
Re: rall. autocalculation function in Scheme
I've given it some more work. The \repeat construct is gone, and the displayed messages indicate that my recursion is working correctly. Metronome marks are not yet printed, however. What am I missing? Also, I'm getting a wrong type argument error message when I try to (let* (current-tempo (car tempo-list))). I feel like I'm almost there though. Code attached, and thanks again. On Mon, 6 Feb 2023 at 14:19, Adam M. Griggs wrote: > Hello list, > > I'm trying to create a Scheme function that will automatically calculate > and enact a *rall*. as a sequence of \tempo assignments. I am aware of > the basic *rall*., *rit*., and *accel*. functions in "articulate.ly" but > I wanted something I have a little more control over. > > I need help, and I don't know if it's just in the implementation details > or my overall approach to the problem. > > For now, it's just a *rall*. The algorithm describing the rate of > slowdown is extremely basic but that can be adjusted later. > > My approach so far has been to create a list of values starting at 100 > (let's assume percentages of the initial tempo and work that in later) and > then have them trickle down. Using #(display ...), I see this is working > just fine. > > Clearly my \repeat call isn't appropriate here and I should replace it > with a recursive function call containing just its body (the {\tempo 4 = > ... \skip ...} part). And I'm sure I'm not really going to get anywhere > with #@tempi-list but I hope it communicates what I'm aiming for. I've been > playing with this for a few hours but I haven't been able to get the parts > to mesh together. I could keep stabbing at it, or ask for help here. > > Code attached, and thank you! > myRall.ily Description: Binary data