lilypond-user
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Generate Random Pitches and Accidentals?


From: Flaming Hakama by Elaine
Subject: Re: Generate Random Pitches and Accidentals?
Date: Mon, 8 Jan 2018 17:47:57 -0800


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:


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"
address@hidden
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

reply via email to

[Prev in Thread] Current Thread [Next in Thread]