curveSin = #(lambda (x) (* 12 (sin (/ x 4)))) curveTan = #(lambda (x) (tan x)) curveGauss = #(lambda (x) (let ((sigma 0.028) (mu 127) (tau 6.283185307179586)) (* (/ 1 (* sigma (sqrt tau))) (exp (/ (- (expt (- x mu) 2)) (* 2 (expt sigma 2))))))) curveSqrt = #(lambda (x) (* (sqrt x) 2)) curveSquare = #(lambda (x) (expt x 2)) curveExp = #(lambda (x) (exp x)) limit = #512 #(define notes (list (ly:make-pitch 0 0) (ly:make-pitch 0 0 1/2) (ly:make-pitch 0 1) (ly:make-pitch 0 1 1/2) (ly:make-pitch 0 2) (ly:make-pitch 0 3) (ly:make-pitch 0 3 1/2) (ly:make-pitch 0 4) (ly:make-pitch 0 4 1/2) (ly:make-pitch 0 5) (ly:make-pitch 0 6 -1/2) (ly:make-pitch 0 6) )) sequence = #(define-music-function (note function end) (ly:music? procedure? integer?) (define (safe-list-ref ls x) (let* ((z (length ls)) (result (list-ref ls (remainder (abs x) z)))) (if (negative? x) (ly:pitch-negate result) result))) (define (safe-inexact->exact x threshold) (let ((z (inexact->exact x))) (if (or (> z threshold) (< z (- threshold))) (- z) z))) (let ((music-list (list note)) (start-pitch (ly:music-property note 'pitch))) (do ((x 1 (1+ x))) ((> x end)) (set! music-list (append music-list (list (ly:music-transpose (ly:music-deep-copy note) (ly:make-pitch 0 (safe-inexact->exact (round (function x)) 2000000000))))))) (make-sequential-music music-list))) \markup \fill-line { \huge \smallCaps Sinus } \new PianoStaff \autochange { \sequence c'16 #curveSin #limit } \pageBreak \markup \fill-line { \huge \smallCaps Gauss } \new PianoStaff \autochange { \sequence c'16 #curveGauss #255 } \pageBreak \markup \fill-line { \huge \smallCaps Racine } \new PianoStaff \autochange { \transpose c c,, \sequence c'16 #curveSqrt #limit } \pageBreak \markup \fill-line { \huge \smallCaps Exposant } \new PianoStaff \autochange { \transpose c a,,, \sequence c'16 #curveSquare #11 } \pageBreak \markup \fill-line { \huge \smallCaps Exponentielle } \new PianoStaff \autochange { \transpose c e,,, \sequence c'8 #curveExp #5 } \pageBreak \markup \fill-line { \huge \smallCaps Tangente } \new PianoStaff \autochange { \sequence c'16 #curveTan #limit }