[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Apply a music-function script to all elements of a list
From: |
Thomas Morley |
Subject: |
Re: Apply a music-function script to all elements of a list |
Date: |
Thu, 4 May 2017 22:47:29 +0200 |
2017-05-04 18:59 GMT+02:00 zaord <address@hidden>:
> 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.
Ofcourse, you try to compare a pitch with a symbol to get an entry
from an alist, so no result.
[...]
> I would like to extact from the varioable only c' in this case.
> Why the function ly:pitch-notename fails ?
It does not fail, though I understand it does not match your
expectations. You know it returns a number.
But then you try to compare a number with a symbol to get an entry
from an alist, so no result.
Brute-force, I sometimes do things like:
#(define (pitch->symbol pitch)
(string->symbol (second (string-split (object->string pitch) #\SPACE))))
The is code of type "Don't get on my nerves" ;)
Though, it works with:
#(define (make-dot-list l1)
(if (null? l1)
empty-stencil
(ly:stencil-add
(make-dot (pitch->symbol (car l1)))
(make-dot-list (cdr l1)))))
Nevertheless, your 'Color-KEY-LIST ' has no entries for c'' and
higher, nor for b,, and below so there are still errors.
> I join the ly file.
You didn't ;)
So I attached the file you sent me earlier. Had not the time to look
into it earlier.
In general I have the impression that things can be done much easier,
but formating/indenting of your file is terrible.
Makes it very hard to read and does not encourage to work on it ;)
Cheers,
Harm
incoctov2.ly
Description: Text Data
- Re: Apply a music-function script to all elements of a list, zaord, 2017/05/04
- Re: Apply a music-function script to all elements of a list,
Thomas Morley <=
- Re: Apply a music-function script to all elements of a list, David Kastrup, 2017/05/04
- Re: Apply a music-function script to all elements of a list, Simon Albrecht, 2017/05/04
- Re: Apply a music-function script to all elements of a list, zaord, 2017/05/06
- Re: Apply a music-function script to all elements of a list, Simon Albrecht, 2017/05/06
- Re: Apply a music-function script to all elements of a list, zaord, 2017/05/10
- Re: Apply a music-function script to all elements of a list, Andrew Bernard, 2017/05/10
- Re: Apply a music-function script to all elements of a list, Andrew Bernard, 2017/05/10
- Re: Apply a music-function script to all elements of a list, David Nalesnik, 2017/05/10
- Re: Apply a music-function script to all elements of a list, daviau ewen, 2017/05/10
- Re: Apply a music-function script to all elements of a list, David Nalesnik, 2017/05/10