> On 1/8/2018 12:44 PM, Joshua Nichols wrote:
>
> I'm looking for a resource that can generate pitches at different octaves,
> using different spellings, including accidentals.
>
> Has someone already implemented this? I'm trying not to reinvent the wheel.
>
> --
> Josh
>
>

There is a discussion of generating random notes in the comments of this
blog post:

http://lilypondblog.org/2014/03/music-functions-1-getting-to-grips-with-scheme-in-lilypond/

The example code is:

#(define myList
  (list
   #{ b2 #}
   #{ c'2 #}
   #{ d'2 #}
   #{ e'2 #}))
mySchemeFunction =#(define-music-function (parser location) ()
  (list-ref myList (random (length myList))))
mySetSeed = #(define-void-function (parser location) ()
     (let ((time (gettimeofday)))
       (set! *random-state*
             (seed->random-state (+ (car time)
                                    (cdr time))))))

{
  \mySetSeed c'4 \mySchemeFunction c' \mySchemeFunction c'
\mySchemeFunction c' \mySchemeFunction c' \mySchemeFunction c'}



HTH,

David Elaine Alt
415 . 341 .4954                                           "*Confusion is
highly underrated*"
[email protected]
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
_______________________________________________
lilypond-user mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/lilypond-user

Reply via email to