[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: custom metronome-markup procedure causes weird goops-error
From: |
Neil Puttock |
Subject: |
Re: custom metronome-markup procedure causes weird goops-error |
Date: |
Fri, 25 Apr 2008 14:44:37 +0100 |
On 25/04/2008, Valentin Villenave <address@hidden> wrote:
> 2008/4/25 Valentin Villenave <address@hidden>:
>
>
> > Here's my code; it works quite well on simple examples, but on complex
> > scores it triggers an error I've never seen:
>
>
> OK, I've fixed it; it actually involved using a different name for the
> metronomeMarkFormatter procedure:
>
> mov =
> #(define-music-function (parser location texte duration count music)
> (string? string? integer? ly:music?)
> (define (format-movement-markup dur count context)
> (make-line-markup
> (list
> (markup #:mvt texte #:hspace 1)
>
> (make-simple-markup "(")
> (make-general-align-markup Y DOWN (make-smaller-markup
> (make-note-by-number-markup (ly:duration-log dur)
> (ly:duration-dot-count dur)
> 1)))
> (make-simple-markup "=")
> (make-simple-markup (number->string count))
> (make-simple-markup ")"))))
>
> (make-music 'SequentialMusic 'elements
> (list (make-music 'ContextSpeccedMusic
> 'context-type 'Score 'element
> (make-music 'PropertySet
> 'value format-movement-markup
> 'symbol 'metronomeMarkFormatter))
>
> (make-music 'ContextSpeccedMusic
> 'context-type 'Score 'element
> (make-music 'SequentialMusic 'elements
> (list (make-music 'PropertySet
> 'value (ly:duration-length (string->duration duration))
> 'symbol 'tempoWholesPerMinute)
> (make-music 'PropertySet
> 'value (string->duration duration)
> 'symbol 'tempoUnitDuration)
> (make-music 'PropertySet
> 'value count
> 'symbol 'tempoUnitCount))))
>
> music
>
> (make-music 'ContextSpeccedMusic
> 'context-type 'Score 'element
>
> (make-music 'PropertySet
> 'value format-metronome-markup
> 'symbol 'metronomeMarkFormatter)))))
>
>
> Now it works perfectly -- sorry for the noise!
That's good, but there are two problems with it; one quite serious if
you value having MIDI output.
First, you haven't set tempoWholesPerMinute properly, unfortunately
(it's the same problem I was scratching my head about in the original
thread): the combination of the note value and beats per minute needs
to be converted to a moment. In the example
\mov #"Largo" #"2." #140
your code sets tempoWholesPerMinute to (ly:make-moment 3 4 1 1),
ignoring the beats-per-minute value, whereas it should be converted to
an integral value, i.e. (ly:make-moment 105 1 0 1) or (ly:make-moment
210 2 0 1).
Second, unlike the helper function parse-simple-duration,
string->duration doesn't account for durations longer than a semibreve
since they can't be directly converted to a number.
So, in conclusion, close but no cigar. ;)
Regards,
Neil
- custom metronome-markup procedure causes weird goops-error, Valentin Villenave, 2008/04/25
- Re: custom metronome-markup procedure causes weird goops-error, Valentin Villenave, 2008/04/25
- Re: custom metronome-markup procedure causes weird goops-error,
Neil Puttock <=
- Re: custom metronome-markup procedure causes weird goops-error, Reinhold Kainhofer, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Nicolas Sceaux, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Valentin Villenave, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Nicolas Sceaux, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Risto Vääräniemi, 2008/04/29
- Re: custom metronome-markup procedure causes weird goops-error, Valentin Villenave, 2008/04/29