Function which return the chords of the degrees of a mode

2017-05-15 Thread zaord
Hi Here,

I'am trying to make a function which is returning a list of 7 chords
corresponding of each degree of a mode.

Exemple :

In X Major, we knows that  the chords are  :


degree 1 : Maj
degree 2 : min
degree 3 : min
degree 4 : Maj
degree 5 : Maj
degree 6 : min
degree 7 : dim

So in C Maj scale, the function will return a list of < g b d >   *.

In A minor the function will return a list of <   * c e g >  
 < g b d >.

Do you have any idea to make this function simple to code ?

Best,

And thanks





--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Function-which-return-the-chords-of-the-degrees-of-a-mode-tp203140.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


Re: Apply a music-function script to all elements of a list

2017-05-11 Thread zaord
Hi Again. Thanks for your help !


Here just few question/ remarks :

1) This is a sheet that I include on my scores for making pedagogical
colored scores for dyslexics people. The file you look on is for diatonic
accordion diagrams and the left hand side of the instrument have bass, and
each button is making a full chord. That is why I was just using the first
élément of the chord (list l1) ( But it was not so clever because for making
7th on the bass side, we combine bass buttons and chord button). I think
it's a really tricky thing to make a code which select only the fndamental
of a chord if it's perfect ones and whic select the 7th by adding another
colored note using a bass to enrich a perfect code by a 7th but in the bass.
I don't know if it's possible and how to code that. (I could do that in C++
but not in scheme :)  )
I hope to be clear, otherwise don't hesitate to ask :)



2) I have also designed a special instrument a button like accordion but you
make your chord by pressing the differents key of the chord componants like
on the piano. So your improvement of the code will be really usefull for
this. But I still have a question because the bass keybord of this
instrument is only 2 octave and now, I get some notes which is going out of
the grid because they are too high... And I can't use /relative c or c''
with chordmode. Do you think it's possible to transpose all the notes from
chordmode an octave lower or higher ?
Here is the file for this instrument : 


3) That seems that the script don't reconize the good notes. Sio I wonder if
the function ly:pitch-notename  is really giving a 0 for C , a 1 for C# a 2
for D .. ? 

Thanks a lot for help !



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Apply-a-music-function-script-to-all-elements-of-a-list-tp200313p203096.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


Re: Apply a music-function script to all elements of a list

2017-05-10 Thread zaord
Hi Simon,

Thanks for your answer. I tryied to add a score in my file to have a
bebugging compilable file.

I get an error when I compile your code (join file) : Wrong type (expecting
Stencil): (# # # # incdiato82.ly
   # # # #)

If I take off the 'apply' from 'apply ly:stencil-add , then the lines you
add works but not the make-dot-list function, and if I delete it, the
make-dot-list works but not the background...

I never learned Scheme at school and this language is not so obvious, and I
have a lot of problems to understand it. Even with guile documentation I
need to have the basic and actually I didn't found anything which explain
from zero. Do you know any good book or tutorial / course ?

I try to do my best,

Thanks for your help again,

ewen







--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Apply-a-music-function-script-to-all-elements-of-a-list-tp200313p203059.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


Re: Apply a music-function script to all elements of a list

2017-05-06 Thread zaord
Hi,

I have a new (small ?) question :

I have define a markup command (below) and this command is calling the
differents functions .
Actually this command is making the differents elements of my customs
diagrams. Firsly the unvariants circles (representing the keyboard of the
instrument in bold) and then the differents colored dots (in itallic on the
code below) depends on the notes of the différents chords.

Now I would like to split this into two differents function, one which
engrave the keybord layout and the other which makes the colored dots since
I need sometines only the colored dots.


#(define-markup-command (complete layout props the-chord)
  (ly:music?)
  (ly:stencil-scale
   (ly:stencil-add   
(*ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 0)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 1)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 2)) 0 0 0 )   
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 3)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 0)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 1)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 2)) 0 0 0 )   
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 3)) 0 0 0 )  
*
/(make-dot-list 
  (map  (lambda (m) (ly:music-property m 'pitch))
(extract-named-music the-chord 'NoteEvent)  )))  1 1))/


I tried to make a other function like this :

#(define (make-background )
ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0 #f)
(cons 0 0)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 1)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 2)) 0 0 0 )   
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 3)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 0)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 1)) 0 0 0 )
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 2)) 0 0 0 )   
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 3)) 0 0 0 ) 
  )

But this make only one dot of the background and not the full keyboard.

Thanks by advance !

Ewen




--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Apply-a-music-function-script-to-all-elements-of-a-list-tp200313p202976.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


Re: Apply a music-function script to all elements of a list

2017-05-04 Thread zaord
Hi,

I still have a little question :

In my code, I use a define-music-function to exctract the nots of chords
from a chordmode , and i compare each pitch of the notes events with a list
to find x/y position of a colored dot making a custom diagram.

My problem is that I can't get the name of the pitch, and when I compare the
pitch and my list, the values didn't match.

#(define-markup-command (complete layout props the-chord)
  (ly:music?)
  (ly:stencil-scale
   (
 
 (make-dot-list 
  (map
(lambda (m) (ly:music-property m 'pitch))
(extract-named-music the-chord 'NoteEvent 
1 1))


diag=
#(define-music-function (parser location music)
  (ly:music?)
  (music-map
(lambda (m)
 (if (music-is-of-type? m 'event-chord)
  #{ <>^\markup \complete #m $m #}
  m))
music))


Here is the code which compare the list and the pitch from music event
function :

#(define (make-dot-list l1)
   (if (null? l1) 
   empty-stencil
   (ly:stencil-add 
  (make-dot (ly:pitch-notename(car l1)))
  (make-dot-list (cdr l1)

I get this error in lilypond.

keyboard diagram error - unkown note '0' 

If I drop the ly:pitch-notename, I get this error instead : fatal error:
keyboard diagram error - unkown note '#'

I would like to extact from the varioable only c' in this case.
Why the function ly:pitch-notename fails ?

I join the ly file.

Thanks By advance.

Ewen







--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Apply-a-music-function-script-to-all-elements-of-a-list-tp200313p202900.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


Apply a music-function script to all elements of a list

2017-02-20 Thread zaord
Hello,

I coded a script that adds markup. This function \ diag allows me to display
a customized diagram (here left hand "button board" of an accordion) and I
would like to apply it to all the elements of a chordmode {}.
The script below works very well but only for a chordmode with 1 element. If
the Chordmode have two elements, then the diagram is writing over himself
but don't follow the score !

In another hand, lilypond does not recreate new diagrams and the diagrams
are superpozed ...

My code  bellow is inspired by  : http://lsr.di.unimi.it/LSR/Item?id=1042  





%-- 

% ici on défini les points qu'on fait sur le piano 
#(define (make-dot-list l1) 
   (if (null? l1) 
   empty-stencil 
   (ly:stencil-add 
  (make-dot (ly:pitch-semitones (car l1))) 
  (make-dot-list (cdr l1) 


% ici on défini i on fait des ronds noirs ou blancs 
#(define (make-dot key) 
(let ((test (cons (key-to-pos key) ( key-to-pos key) )))   
 (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil  0.25
0.1 #f) (  key-to-pos key  )) (car(  key-to-color key ) )(car(  key-to-color
key ) )(car(  key-to-color key ) ) ) ))  % pour les ronds noirs 
  

% ici on défini les couleurs R V B associés à chaque notes 
#(define (key-to-color key ) 
  (let ((keycolor (caddr(assq key Color-KEY-LIST 
   (if (not keycolor) 
(ly:error (_ "Color diagram error - unkown note '~a'") key) 
( caddr (assq key Color-KEY-LIST)  



#(define KEY-POS-LIST'(   
   (-8   .  '( 0  . 0)) 
   (-7   .  '( 0  . 1)) 
   (-6   .  '( 0  . 2)) 
   (-5   .  '( 0  . 3)) 
   (-4   .  '( 1  . 0)) 
   (-3   .  '( 1  . 1)) 
   (-2   .  '( 1  . 2)) 
   (-1   .  '( 1  . 3)) 
   (0   .  '( 0  . 0)) 
   (1   .  '( 0  . 1)) 
   (2   .  '( 0  . 2)) 
   (3   .  '( 0  . 3)) 
   (4   .  '( 1  . 0)) 
   (5   .  '( 1  . 1)) 
   (6   .  '( 1  . 2)) 
   (7   .  '( 1  . 3)) 
   (8   .  '( 0.71  . 1)) 
   (9   .  '( 0.71  . 1)) 
   (10  .  '( 0.71  . 1)) 
   (11  .  '( 0.71  . 1)) 
   (12  .  '( 0.71  . 1)) 
   (13  .  '( 0.71  . 1)) 
   (14  .  '( 0.71  . 1)) 
   (15  .  '( 0.71  . 1)) 
   (16  .  '( 0.71  . 1)) 
   (17  .  '( 0.71  . 1)) 
   (18  .  '( 0.71  . 1)) 
   (19  .  '( 0.71  . 1)) 
   (20  .  '( 0.71  . 1)) 
   (21  .  '( 0.71  . 1)) 
   (22  .  '( 0.71  . 1)) 
   (23  .  '( 0.71  . 1)) 
   )) 


#(define Color-KEY-LIST'(   
   (-11 .  '( 0.71 11)) 
   (-10 .  '( 0.71 11)) 
   (-9  .  '( 0.71 11)) 
   (-8  .  '( 0.71 11)) 
   (-7  .  '( 0.71 11)) 
   (-6  .  '( 0.71   0.2   1)) 
   (-5  .  '( 0.71   0.2   1)) 
   (-4  .  '( 0.71   0.2   1)) 
   (-3  .  '( 0.71   0.2   1)) 
   (-2  .  '( 0.71   0.2   1)) 
   (-1  .  '( 0.71   0.2   1)) 
   (0   .  '( 0.71 11)) 
   (1   .  '( 0.71 11)) 
   (2   .  '( 0.71 11)) 
   (3   .  '( 0.71 11)) 
   (4   .  '( 0.71 11)) 
   (5   .  '( 0.71   0.2   1)) 
   (6   .  '( 0.71   0.2   1)) 
   (7   .  '( 0.71   0.2   1)) 
   (8   .  '( 0.71   0.2   1)) 
   (9   .  '( 0.71   0.2   1)) 
   (10  .  '( 0.71   0.2   1)) 
   (11  .  '( 0.71   0.2   1)) 
   (12  .  '( 0.71   0.2   1)) 
   (13  .  '( 0.71   0.2   1)) 
   (14  .  '( 0.71   0.2   1)) 
   (15  .  '( 0.71   0.2   1)) 
   (16  .  '( 0.71   0.2   1)) 
   (17  .  '( 0.71   0.2   1)) 
   (18  .  '( 0.71   0.2   1)) 
   (19  .  '( 0.71   0.2   1)) 
   (20  .  '( 0.71   0.2   1)) 
   (21  .  '( 0.71   0.2   1)) 
   (22  .  '( 0.71   0.2   1)) 
   (23  .  '( 0.71   0.2   1)) 
   )) 


% ici on défini les positions des points du clavier en y 
#(define (key-to-pos key ) 
  (let ((keypos (assq key KEY-POS-LIST))) 
   (if (not keypos) 
(ly:error (_ "keyboard diagram error - unkown note '~a'") key) 
(caddr (assq key KEY-POS-LIST)  



#(define-markup-command (complete layout props the-chord) 
  (ly:music?) 
  (ly:stencil-scale 
   (ly:stencil-add   
(ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0 #f)
(cons 0 0)) 0 0 0 ) 
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 1)) 0 0 0 ) 
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 2)) 0 0 0 )   
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 0 3)) 0 0 0 ) 
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 0)) 0 0 0 ) 
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 1)) 0 0 0 ) 
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 2)) 0 0 0 )   
  (ly:stencil-in-color(ly:stencil-translate (make-circle-stencil 0.4 0
#f) (cons 1 3)) 0 0 0 )   
(make-dot-list 
  (map 
(lambda (m) (ly:music-property m 'pitch)) 
(extract-named-music the-chord 'NoteEvent 
1 1)) 

diag= 
#(define-music-function (parser location the-chord) 
  (ly:music?) 
  #{ <>^\markup \complete #the-

Polyrythmic exercices with two gridline on the top and bottom of a score with two rythmics voices

2013-11-07 Thread zaord
Hi here,

I try to do an exercice partition for working on polyrythms with two
simultaneous rythms.
I have a score with two voice, for the two rythme of the polyrythm.

I want a gridline on the top, giving the pulse of the top-voice and a
another gridline in a different collor for emphasis the pulse of the second
rythm-voice.

There is a bug there and I don't knox how to solve it ;)


Here is my code:

\version "2.12.0" 
#(set-global-staff-size 30) 
#(set-default-paper-size "a4" 'landscape) 


global = { 
  \time 12/4 

} 


\layout { 
  \context { 

 \Staff 
 \override Staff.VerticalAxisGroup #'minimum-Y-extent = #'(4 . -4) 
 %\override GridPoint.Y-extent = #'(4 . -4) 
   \override TupletNumber #'transparent = ##t 
  \override TupletBracket #'bracket-visibility = ##f 
\consists "Grid_point_engraver" 
gridInterval = #(ly:make-moment 1/12) 
\remove "Time_signature_engraver" 
\remove "Clef_engraver" 
 } 
 \context { 
  \Score 
   \consists "Grid_line_span_engraver" 
  % center grid lines horizontally below note heads 
  \override NoteColumn.X-offset = #-0.5 
  \override NonMusicalPaperColumn #'line-break-permission = ##f 
} 
ragged-right = ##t 
} 

\score { 
  \new ChoirStaff { 
\relative c'' << 
  \new Staff { 

  
  
\time 12/4 
% hides staff and notes so that only the grid lines are visible 
\hideNotes 
\override Staff.BarLine.transparent = ##t 
\override Staff.StaffSymbol.line-count = #0 

% dummy notes to force regular note spacing 
\once   \override Score.GridLine.thickness = #4.0  \once \override
Score.GridLine.color = #red 
   \times 12/4 { c4 c c } 
\once   \override Score.GridLine.thickness = #4.0  \once \override
Score.GridLine.color = #red 
c4 c c c c c c c c c c c 
\once   \override Score.GridLine.thickness = #4.0  \once \override
Score.GridLine.color = #red 
c4 c c c c c c c c c c c 
} 
  
  \new Staff \with {  instrumentName = \markup \center-column {Ex: 
5 6 }  } <<\new Voice  { \voiceOne \relative c'' {  \time 12/8 
r4 e  r r e r r e e r r e | e e r e~ e e e~ e r e~ e e | r e e e r r e r
e r e e  | } } \new Voice { \voiceTwo \relative c' { \global 
f4 r r f r f f r f r f f | r f f r f r r f f r r f | f~ f f f f r f~ f r
f~ f r |} } >>   

   \new Staff { 


  \time 12/4 
% hides staff and notes so that only the grid lines are visible 
\hideNotes 
\override Staff.BarLine.transparent = ##t 
\override Staff.StaffSymbol.line-count = #0 
  

% dummy notes to force regular note spacing 
  \once \override Score.GridLine.thickness = #4.0  \once   \override
Score.GridLine.color = #blue 
c4 c c c c c c c c c c c 
\once   \override Score.GridLine.thickness = #4.0  \once \override
Score.GridLine.color = #blue 
  c4 c c c c c c c c c c c 
\once   \override Score.GridLine.thickness = #4.0  \once \override
Score.GridLine.color = #blue 
 c4 c c c c c c c c c c c   
  
  } 
>> 
  } 
} 


Best and thanks

Ewen



--
View this message in context: 
http://lilypond.1069038.n5.nabble.com/Polyrythmic-exercices-with-two-gridline-on-the-top-and-bottom-of-a-score-with-two-rythmics-voices-tp153516.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