Re: Generate Random Pitches and Accidentals?

2018-01-10 Thread Joshua Nichols
David,

This looks fantastic. I'll play with it. Thank you so much!

--
Josh

On Mon, Jan 8, 2018 at 6:19 PM, David Nalesnik 
wrote:

> Hi Josh,
>
> On Mon, Jan 8, 2018 at 4:34 PM, Joshua Nichols 
> wrote:
> > Hi! This is for education!
> >
> > On Jan 8, 2018 3:08 PM, "Karlin High"  wrote:
> >>
> >> On 1/8/2018 11:44 AM, Joshua Nichols wrote:
> >>>
> >>> I'm looking for a resource that can generate pitches at different
> >>> octaves, using different spellings, including accidentals.
> >>
> >>
> >> How will this be used? As an educational tool, perhaps? Describing the
> use
> >> case might get better help.
> >> --
> >> Karlin High
> >> Missouri, USA
>
> Here is a worksheet I created with answers and different pitch content
> every time you run it.  Perhaps you will find something useful in it.
>
> (Note: if you're running a development version, you can cut out the
> definition of the table command.  I included it so I could run
> this--and many other "auto" worksheets--using lilybin.
>
> Hope this helps,
> David
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-09 Thread Blöchl Bernhard
I have not read the messages in the thread, so may be anybody has 
already provided a solution to your problem.

I always planned to try
http://projectabjad.org/
for algorithmic (fractal) composition of music, never found the time.
Check it, may be abjad is of use for you? (There is another program 
equally named Abjad - The Arabic Alphabet Learning System.)


Regards

Am 08.01.2018 18:44, schrieb Joshua Nichols:

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
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Flaming Hakama by Elaine
> 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*"
ela...@flaminghakama.com
skype: flaming_hakama
Producer ~ Composer ~ Instrumentalist
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Karlin High

On 1/8/2018 5:19 PM, David Nalesnik wrote:

Here is a worksheet I created with answers and different pitch content
every time you run it.


That thing is... astonishing.

The places where David Nalesnik and Thomas Morley live are going to have 
acute shortages of parentheses any day now.

--
Karlin High
Missouri, USA

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread David Nalesnik
On Mon, Jan 8, 2018 at 5:19 PM, David Nalesnik  wrote:
> Hi Josh,
>
> On Mon, Jan 8, 2018 at 4:34 PM, Joshua Nichols  
> wrote:
>> Hi! This is for education!
>>
>> On Jan 8, 2018 3:08 PM, "Karlin High"  wrote:
>>>
>>> On 1/8/2018 11:44 AM, Joshua Nichols wrote:

 I'm looking for a resource that can generate pitches at different
 octaves, using different spellings, including accidentals.
>>>
>>>
>>> How will this be used? As an educational tool, perhaps? Describing the use
>>> case might get better help.
>>> --
>>> Karlin High
>>> Missouri, USA
>
> Here is a worksheet I created with answers and different pitch content
> every time you run it.  Perhaps you will find something useful in it.
>
> (Note: if you're running a development version, you can cut out the
> definition of the table command.  I included it so I could run
> this--and many other "auto" worksheets--using lilybin.
>

BTW,

I turned on the accidentals b/c you asked about them.  The point of
the exercise is better served by using the line

test = \questions 30 #(list 0)

instead of the definition of test in the file

(i.e, just white notes)

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread David Nalesnik
Hi Josh,

On Mon, Jan 8, 2018 at 4:34 PM, Joshua Nichols  wrote:
> Hi! This is for education!
>
> On Jan 8, 2018 3:08 PM, "Karlin High"  wrote:
>>
>> On 1/8/2018 11:44 AM, Joshua Nichols wrote:
>>>
>>> I'm looking for a resource that can generate pitches at different
>>> octaves, using different spellings, including accidentals.
>>
>>
>> How will this be used? As an educational tool, perhaps? Describing the use
>> case might get better help.
>> --
>> Karlin High
>> Missouri, USA

Here is a worksheet I created with answers and different pitch content
every time you run it.  Perhaps you will find something useful in it.

(Note: if you're running a development version, you can cut out the
definition of the table command.  I included it so I could run
this--and many other "auto" worksheets--using lilybin.

Hope this helps,
David
\version "2.18.2"

% This file generates a customizable number of random white note pitches
% for identification.  Answers can be displayed.

% The following function is copied from scm/define-markup-commands.scm.
% Not needed in newer versions of LilyPond.
#(define-markup-list-command (table layout props column-align lst)
   (number-list? markup-list?)
   #:properties ((padding 0)
 (baseline-skip))

   (define (split-lst initial-lst lngth result-lst)
 ;; split a list into a list of sublists of length lngth
 ;; eg. (split-lst '(1 2 3 4 5 6) 2 '())
 ;; -> ((1 2) (3 4) (5 6))
 (cond ((not (integer? (/ (length initial-lst) lngth)))
(ly:warning
 "Can't split list of length ~a into ~a parts, returning empty list"
 (length initial-lst) lngth)
'())
   ((null? initial-lst)
(reverse result-lst))
   (else
(split-lst
 (drop initial-lst lngth)
 lngth
 (cons (take initial-lst lngth) result-lst)

   (define (dists-list init padding lst)
 ;; Returns a list, where each element of `lst' is
 ;; added to the sum of the previous elements of `lst' plus padding.
 ;; `init' will be the first element of the resulting list. The addition
 ;; starts with the values of `init', `padding' and `(car lst)'.
 ;; eg. (dists-list 0.01 0.1 '(1 2 3 4)))
 ;; -> (0.01 1.11 3.21 6.31 10.41)
 (if (or (not (number? init))
 (not (number? padding))
 (not (number-list? lst)))
 (begin
  (ly:warning
   "not fitting argument for `dists-list', return empty lst ")
  '())
 (reverse
  (fold (lambda (elem rl) (cons (+ elem padding (car rl)) rl))
(list init)
lst

   (let* (;; get the number of columns
   (columns (length column-align))
   (init-stils (interpret-markup-list layout props lst))
   ;; If the given markup-list is the result of a markup-list call, their
   ;; length may not be easily predictable, thus we add point-stencils
   ;; to fill last row of the table.
   (rem (remainder (length init-stils) columns))
   (filled-stils
(if (zero? rem)
init-stils
(append init-stils (make-list (- columns rem) point-stencil
   ;; get the stencils in sublists of length `columns'
   (stils
(split-lst filled-stils columns '()))
   ;; procedure to return stencil-length
   ;; If it is nan, return 0
   (lengths-proc
(lambda (m)
  (let ((lngth (interval-length (ly:stencil-extent m X
(if (nan? lngth) 0 lngth
   ;; get the max width of each column in a list
   (columns-max-x-lengths
(map
 (lambda (x)
   (apply max 0
 (map
  lengths-proc
  (map (lambda (l) (list-ref l x)) stils
 (iota columns)))
   ;; create a list of (basic) distances, which each column should
   ;; moved, using `dists-list'. Some padding may be added.
   (dist-sequence
(dists-list 0 padding columns-max-x-lengths))
   ;; Get all stencils of a row, moved accurately to build columns.
   ;; If the items of a column are aligned other than left, we need to
   ;; move them to avoid collisions:
   ;; center aligned: move all items half the width of the widest item
   ;; right aligned: move all items the full width of the widest item.
   ;; Added to the default-offset calculated in `dist-sequence'.
   ;; `stencils-for-row-proc' needs four arguments:
   ;;stil- a stencil
   ;;dist- a numerical value as basic offset in X direction
   ;;column  - a numerical value for the column we're in
   ;;x-align - a numerical value how current column should be
   ;;  aligned, where (-1, 0, 1) means (LEFT, CENTER, RIGHT)
   (stencils-for-row-proc
(lambda 

Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Joshua Nichols
Unfortunately it does not, and I don't know SCHEME well enough to know what
to do, or even start.

On Jan 8, 2018 5:55 PM, "Thomas Morley"  wrote:

> 2018-01-08 18:44 GMT+01:00 Joshua Nichols :
> > 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
>
>
> http://lsr.di.unimi.it/LSR/Item?id=274
> already fits your needs?
>
> Cheers,
>   Harm
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Thomas Morley
2018-01-08 18:44 GMT+01:00 Joshua Nichols :
> 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


http://lsr.di.unimi.it/LSR/Item?id=274
already fits your needs?

Cheers,
  Harm

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Joshua Nichols
Hi! This is for education!

On Jan 8, 2018 3:08 PM, "Karlin High"  wrote:

> On 1/8/2018 11:44 AM, Joshua Nichols wrote:
>
>> I'm looking for a resource that can generate pitches at different
>> octaves, using different spellings, including accidentals.
>>
>
> How will this be used? As an educational tool, perhaps? Describing the use
> case might get better help.
> --
> Karlin High
> Missouri, USA
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Ben


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


Hi Josh,

What is your end goal with this? School project? Composition tool?

I did something like this once a while back, though it was easier and 
faster for me at the time to just load up Reaper, use a plugin/script to 
generate the random note data, and just export out the notation to pdf 
or musicxml. Then it was all LilyPond after that for my project.


Does this have to be contained *fully* in LilyPond for your purposes?

Give us some more info please :)

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: Generate Random Pitches and Accidentals?

2018-01-08 Thread Karlin High

On 1/8/2018 11:44 AM, Joshua Nichols wrote:
I'm looking for a resource that can generate pitches at different 
octaves, using different spellings, including accidentals.


How will this be used? As an educational tool, perhaps? Describing the 
use case might get better help.

--
Karlin High
Missouri, USA

___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Generate Random Pitches and Accidentals?

2018-01-08 Thread Joshua Nichols
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
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user