Re: guitar scale diagram - change root

2016-09-02 Thread David Kastrup
bart deruyter  writes:

> It's strange to say, but lilypond is so good that most often scheme is
> not needed, which makes the actual use of scheme rare (for me at
> least), which in turn does not let me train it :-) .

That is sort of an intentional consequence of a lot of post 2.12 work.
There is an example for how to program in Scheme in some of the manuals,
and it had to be changed a few times until ending up basically with a
premise of "let's pretend we could not perfectly well do this in
LilyPond already without reverting to Scheme".  And when one has to
revert to Scheme, things map more directly to LilyPond than they used
to.

So you need Scheme less than previously, but when you do, it is not as
hard as it was once.

-- 
David Kastrup

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


Re: guitar scale diagram - change root

2016-09-02 Thread bart deruyter
Hey,

thanks for the help and I think I understand the explanation about Lisp.

I thought it would be something like this though, the error message made me
think that scheme wasn't able to read the variable,  I only did not know
why, now I do :-) .

Another problem for me is having usecases to learn scheme. I mean, I can
read other code and learn from it, but it doesn't let you think in a
'problem-solving' way because the solution already is there.

I learn best by having something concrete, like the above and ponder about
it to add new things. That way, I won't forget the solution because of the
effort I've put into it and because of the research I've put into it.
It's not productive at all to begin, but it does train your mind to think
as a computer, which in my experience does make it productive in the end.

It's strange to say, but lilypond is so good that most often scheme is not
needed, which makes the actual use of scheme rare (for me at least), which
in turn does not let me train it :-) .

Now I'll (lily)ponder on :-)

grtz,
Bart

http://www.bartart3d.be/
On Twitter 
On Identi.ca 
On Google+ 

2016-09-01 21:16 GMT+02:00 David Kastrup :

> bart deruyter  writes:
>
> > #(define-markup-command (scale-diagramm layout props arg1 arg2 start arg3
> > arg4) (list? integer? integer? number? integer?)
> >
> > (interpret-markup layout props
> >
> > (markup
> >
> >  (#:override (cons 'size arg3 )
> >
> > (#:override '(fret-diagram-details
> > . (
> >(finger-code . in-dot)
> >(number-type . arabic)
> >(label-dir   . -1)
> >(orientation . landscape)
> >(dot-radius  . 0.4)
> >(fret-count . arg4 )
> >(top-fret-thickness . 4)))
> >  #:fret-diagram-verbose
> > (fret-from-list arg1 '() arg2 start ))
> >
> > but then I get this error:
> >
> > Preprocessing graphical objects...fret-diagrams.scm <0>: In procedure >
> in
> > expression (> maxfret my-fret-count):
> >
> > fret-diagrams.scm <1>: Wrong type argument in position 2: arg4
> >
> >
> > Clearly it's an issue of 'type argument'. When I change fret-count to the
> > actual integer 12 instead of the variable arg4, it works. It is probably
> > something schemy I don't get...
>
> arg4 is a symbol in a quoted list, just like landscape, arabic, in-dot
> are.  If you replace the quote ' after #:override with a "quasiquote",
> namely the backward tick ` then you can "unquote" inside of the
> expression by preceding something with , the unquote character.  When
> an expression is unquoted, it is evaluated as normal and placed in the
> quoted list.  So you'd have
> (#:override `(fret-diagram-details
>   [...]
>   (fret-count . ,arg4)
>   [...]
>
> Lisp (and Scheme) do not actually have a program syntax.  Instead you
> enter the parse tree as a data structure, a nested list.  Every start of
> a list is a function call, every symbol is looked up as a variable
> (functions are just special variable values) and the remaining list
> elements are the argument of the function call, evaluated before
> calling.  Or, in case we are talking about a macro (or special form)
> instead of a function, passed unevaluated to the macro and the result of
> the macro call is then evaluated.
>
> That sounds awfully complex, but that's all there is to Scheme program
> structure.  The only "syntax" you have to deal with is actually for data
> entry, most of which consists of lists.
>
> Once you realise that Scheme does not have a program syntax, just a
> program _structure_ and that the syntax is only for data entry, it
> becomes obvious
> a) why Scheme feels so different from other languages
> b) why it is so great for macro/program manipulation
>
> --
> David Kastrup
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: guitar scale diagram - change root

2016-09-01 Thread David Kastrup
bart deruyter  writes:

> #(define-markup-command (scale-diagramm layout props arg1 arg2 start arg3
> arg4) (list? integer? integer? number? integer?)
>
> (interpret-markup layout props
>
> (markup
>
>  (#:override (cons 'size arg3 )
>
> (#:override '(fret-diagram-details
> . (
>(finger-code . in-dot)
>(number-type . arabic)
>(label-dir   . -1)
>(orientation . landscape)
>(dot-radius  . 0.4)
>(fret-count . arg4 )
>(top-fret-thickness . 4)))
>  #:fret-diagram-verbose
> (fret-from-list arg1 '() arg2 start ))
>
> but then I get this error:
>
> Preprocessing graphical objects...fret-diagrams.scm <0>: In procedure > in
> expression (> maxfret my-fret-count):
>
> fret-diagrams.scm <1>: Wrong type argument in position 2: arg4
>
>
> Clearly it's an issue of 'type argument'. When I change fret-count to the
> actual integer 12 instead of the variable arg4, it works. It is probably
> something schemy I don't get...

arg4 is a symbol in a quoted list, just like landscape, arabic, in-dot
are.  If you replace the quote ' after #:override with a "quasiquote",
namely the backward tick ` then you can "unquote" inside of the
expression by preceding something with , the unquote character.  When
an expression is unquoted, it is evaluated as normal and placed in the
quoted list.  So you'd have
(#:override `(fret-diagram-details
  [...]
  (fret-count . ,arg4)
  [...]

Lisp (and Scheme) do not actually have a program syntax.  Instead you
enter the parse tree as a data structure, a nested list.  Every start of
a list is a function call, every symbol is looked up as a variable
(functions are just special variable values) and the remaining list
elements are the argument of the function call, evaluated before
calling.  Or, in case we are talking about a macro (or special form)
instead of a function, passed unevaluated to the macro and the result of
the macro call is then evaluated.

That sounds awfully complex, but that's all there is to Scheme program
structure.  The only "syntax" you have to deal with is actually for data
entry, most of which consists of lists.

Once you realise that Scheme does not have a program syntax, just a
program _structure_ and that the syntax is only for data entry, it
becomes obvious
a) why Scheme feels so different from other languages
b) why it is so great for macro/program manipulation

-- 
David Kastrup

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


Re: guitar scale diagram - change root

2016-09-01 Thread bart deruyter
Back to scale diagrams.

I'm still using the enhanced version I received, but I want to contribute
something too for a change, but boy, am I wrong :-p. I end up needing help
again.

I tried something on my own, but I don't get it working, probably because I
just can't wrap my mind around scheme. I don't know why, I understand php,
I can get things working in python, but scheme... I keep trying though :-).

I think this might be practical material for a tutorial :-).

First of all, I'm refering to this snippet:
http://lsr.di.unimi.it/LSR/Item?id=790

It got enhanced by Klaus Blum to be able to change the numbering in the
dots.

What I want to change now is the amount of frets shown on the diagram. I
can of course change it in the snippet, but I want to be able to change it
by adding an argument, so I can get three different diagrams, with three
different amount of frets, like:

cmajor=\markup\scale-diagramm #'((5 3) (5 5) (4 2) (4 3) (4 5) (3 2) (3 4)
 (3 5) (2 3) (2 5) (2 6) (1 3) (1 5) (1 7)
(1 8)) #7 #1 #1.5  #12

#7 defines the amount of notes in the scale (arg2)
#1 defines that it should be the first note to start the diagram (start)
#1.5 scales the diagram.(arg3)

the last number would then be the amount of frets (here 12) (arg4)

I tried to work by example and changed this:

#(define-markup-command (scale-diagramm layout props arg1 arg2 start arg3 )
(list? integer? integer? number?)

to this

#(define-markup-command (scale-diagramm layout props arg1 arg2 start arg3
arg4) (list? integer? integer? number? integer?)

(interpret-markup layout props

(markup

 (#:override (cons 'size arg3 )

(#:override '(fret-diagram-details
. (
   (finger-code . in-dot)
   (number-type . arabic)
   (label-dir   . -1)
   (orientation . landscape)
   (dot-radius  . 0.4)
   (fret-count . arg4 )
   (top-fret-thickness . 4)))
 #:fret-diagram-verbose
(fret-from-list arg1 '() arg2 start ))

but then I get this error:

Preprocessing graphical objects...fret-diagrams.scm <0>: In procedure > in
expression (> maxfret my-fret-count):

fret-diagrams.scm <1>: Wrong type argument in position 2: arg4


Clearly it's an issue of 'type argument'. When I change fret-count to the
actual integer 12 instead of the variable arg4, it works. It is probably
something schemy I don't get...

http://www.bartart3d.be/
On Twitter <https://twitter.com/#%21/Bart_Issimo>
On Identi.ca <http://identi.ca/bartart3d>
On Google+ <https://plus.google.com/u/0/b/116379400376517483499/>

2015-11-22 10:21 GMT+01:00 bart deruyter <bart.deruy...@gmail.com>:

> Hey,
>
> thank you for the idea's. I thought I had to add an argument to the list,
> but I'm not that advanced in using lilypond to implement it myself. With
> this kind of solutions my understanding grows bit by bit :-) .
>
> That other thread was very interesting for me indeed.
>
> It works, great!
>
> grtz,
>
> Bart
>
> http://www.bartart3d.be/
> On Twitter <https://twitter.com/#%21/Bart_Issimo>
> On Identi.ca <http://identi.ca/bartart3d>
> On Google+ <https://plus.google.com/u/0/b/116379400376517483499/>
>
> 2015-11-20 15:02 GMT+01:00 Klaus Blum <benbigno...@gmx.de>:
>
>> Hi Bart,
>>
>> yes, that's no problem.
>> In the attached file, I've added a parameter "start". It's an integer to
>> indicate the tone number to start with, i.e. 1 for the root etc. This
>> might
>> be a start.
>>
>> Recently, there has been another thread that might be interesting for you
>> as
>> well:
>> http://lilypond.1069038.n5.nabble.com/Guitar-Fret-
>> Diagram-scale-degree-below-string-td179664.html#a179739
>>
>> Cheers,
>> Klaus
>>
>> ChangeRoot.ly
>> <http://lilypond.1069038.n5.nabble.com/file/n183842/ChangeRoot.ly>
>>
>>
>> bart deruyter wrote
>> > I'm assembling a list of scales for my students. with scale diagrams.
>> I've
>> > successfully implementend : http://lsr.di.unimi.it/LSR/Item?id=790 .
>> But
>> > now I stumble on another problem.
>> >
>> > The snippet for the scale diagram assumes that the lowest sounding note
>> is
>> > the root of the scale. What if it isn't the case?
>> > I'd like to change the root to for example the second note in the list,
>> or
>> > the third, whichever I'd need as root.
>> >
>> > Can this be achieved by adding something to the snippet?
>>
>>
>>
>>
>>
>> --
>> View this message in context: http://lilypond.1069038.n5.
>> nabble.com/guitar-scale-diagram-change-root-tp183837p183842.html
>> Sent from the User mailing list archive at Nabble.com.
>>
>> ___
>> 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: guitar scale diagram - change root

2015-11-22 Thread bart deruyter
Hey,

thank you for the idea's. I thought I had to add an argument to the list,
but I'm not that advanced in using lilypond to implement it myself. With
this kind of solutions my understanding grows bit by bit :-) .

That other thread was very interesting for me indeed.

It works, great!

grtz,

Bart

http://www.bartart3d.be/
On Twitter <https://twitter.com/#%21/Bart_Issimo>
On Identi.ca <http://identi.ca/bartart3d>
On Google+ <https://plus.google.com/u/0/b/116379400376517483499/>

2015-11-20 15:02 GMT+01:00 Klaus Blum <benbigno...@gmx.de>:

> Hi Bart,
>
> yes, that's no problem.
> In the attached file, I've added a parameter "start". It's an integer to
> indicate the tone number to start with, i.e. 1 for the root etc. This might
> be a start.
>
> Recently, there has been another thread that might be interesting for you
> as
> well:
>
> http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-td179664.html#a179739
>
> Cheers,
> Klaus
>
> ChangeRoot.ly
> <http://lilypond.1069038.n5.nabble.com/file/n183842/ChangeRoot.ly>
>
>
> bart deruyter wrote
> > I'm assembling a list of scales for my students. with scale diagrams.
> I've
> > successfully implementend : http://lsr.di.unimi.it/LSR/Item?id=790 . But
> > now I stumble on another problem.
> >
> > The snippet for the scale diagram assumes that the lowest sounding note
> is
> > the root of the scale. What if it isn't the case?
> > I'd like to change the root to for example the second note in the list,
> or
> > the third, whichever I'd need as root.
> >
> > Can this be achieved by adding something to the snippet?
>
>
>
>
>
> --
> View this message in context:
> http://lilypond.1069038.n5.nabble.com/guitar-scale-diagram-change-root-tp183837p183842.html
> Sent from the User mailing list archive at Nabble.com.
>
> ___
> 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: guitar scale diagram - change root

2015-11-20 Thread Klaus Blum
Hi Bart, 

yes, that's no problem. 
In the attached file, I've added a parameter "start". It's an integer to
indicate the tone number to start with, i.e. 1 for the root etc. This might
be a start.

Recently, there has been another thread that might be interesting for you as
well:
http://lilypond.1069038.n5.nabble.com/Guitar-Fret-Diagram-scale-degree-below-string-td179664.html#a179739

Cheers, 
Klaus

ChangeRoot.ly
<http://lilypond.1069038.n5.nabble.com/file/n183842/ChangeRoot.ly>  


bart deruyter wrote
> I'm assembling a list of scales for my students. with scale diagrams. I've
> successfully implementend : http://lsr.di.unimi.it/LSR/Item?id=790 . But
> now I stumble on another problem.
> 
> The snippet for the scale diagram assumes that the lowest sounding note is
> the root of the scale. What if it isn't the case?
> I'd like to change the root to for example the second note in the list, or
> the third, whichever I'd need as root.
> 
> Can this be achieved by adding something to the snippet?





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/guitar-scale-diagram-change-root-tp183837p183842.html
Sent from the User mailing list archive at Nabble.com.

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


guitar scale diagram - change root

2015-11-20 Thread bart deruyter
Hi all,

I'm assembling a list of scales for my students. with scale diagrams. I've
successfully implementend : http://lsr.di.unimi.it/LSR/Item?id=790 . But
now I stumble on another problem.

The snippet for the scale diagram assumes that the lowest sounding note is
the root of the scale. What if it isn't the case?
I'd like to change the root to for example the second note in the list, or
the third, whichever I'd need as root.

Can this be achieved by adding something to the snippet?

grtz,

Bart

http://www.bartart3d.be/
On Twitter 
On Identi.ca 
On Google+ 
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user