Re: Lilypond's internal pitch representation and microtonal notation

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Carl Sorensen
On 9/20/10 10:00 AM, "Wols Lists" <[hidden email]> wrote:

>  On 20/09/10 14:41, Hans Aberg wrote:
>>> As a related issue, have you considered how (different kinds of)
>>> transposition would be handled in your pitch scheme?
>>
>>
>> This is much simpler: the linear combinations are vectors that you
>> just add. For example, if a, b, c, ... are represented by 0, M, m+M,
>> ..., and you want to transpose from b to c, just add m. A sharp is M-m
>> and a flat m-M. If you want transpose from a note x to a note y, just
>> add y - x.
> What you've missed (and I need to address) is "what is x?".
>
> Let's say I want to transpose up three semitones. That's probably easy,
> it's a minor third, but it could be an augmented second. So, trying to
> remember the pitch class, is it (0,2,sharp) or (0,3,flat)? And, for your
> example of that, I've currently got a modified chord engraver on the
> frogs list that's added a guitar capo property. All the engraver is told
> is how many semitones to transpose, and it's got to sort out all the keys!

In reading this, I may have a suggestion for how to handle your
transposition problem with the capo.

What if instead of giving the fret number for placing the capo, you gave the
sounding key and the fretboard (capo) key.  Then you could transpose the
sounding chords by the difference in the keys, and you'd get the chord names
you want.  And you could calulate the capo fret based on the difference in
the keys as well.

The challenge we had in the past was not enough information to do the right
thing, because we were looking at just the fret count.  Then, starting from
the fret count, we tried to infer the pitch offset, but 3 semitones is
ambiguous.

Instead, if we start with the pitch offset, we can have either 2 tones minus
1 semitone or 1 tone plus 1 semitone.  Then we can convert either one into a
capo fret without any ambiguity at all.

HTH,

Carl
 


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Wols Lists
 On 20/09/10 19:57, Carl Sorensen wrote:

> On 9/20/10 10:00 AM, "Wols Lists" <[hidden email]> wrote:
>
>>  On 20/09/10 14:41, Hans Aberg wrote:
>>>> As a related issue, have you considered how (different kinds of)
>>>> transposition would be handled in your pitch scheme?
>>>
>>> This is much simpler: the linear combinations are vectors that you
>>> just add. For example, if a, b, c, ... are represented by 0, M, m+M,
>>> ..., and you want to transpose from b to c, just add m. A sharp is M-m
>>> and a flat m-M. If you want transpose from a note x to a note y, just
>>> add y - x.
>> What you've missed (and I need to address) is "what is x?".
>>
>> Let's say I want to transpose up three semitones. That's probably easy,
>> it's a minor third, but it could be an augmented second. So, trying to
>> remember the pitch class, is it (0,2,sharp) or (0,3,flat)? And, for your
>> example of that, I've currently got a modified chord engraver on the
>> frogs list that's added a guitar capo property. All the engraver is told
>> is how many semitones to transpose, and it's got to sort out all the keys!
> In reading this, I may have a suggestion for how to handle your
> transposition problem with the capo.
>
> What if instead of giving the fret number for placing the capo, you gave the
> sounding key and the fretboard (capo) key.  Then you could transpose the
> sounding chords by the difference in the keys, and you'd get the chord names
> you want.  And you could calulate the capo fret based on the difference in
> the keys as well.
>
> The challenge we had in the past was not enough information to do the right
> thing, because we were looking at just the fret count.  Then, starting from
> the fret count, we tried to infer the pitch offset, but 3 semitones is
> ambiguous.
>
> Instead, if we start with the pitch offset, we can have either 2 tones minus
> 1 semitone or 1 tone plus 1 semitone.  Then we can convert either one into a
> capo fret without any ambiguity at all.
>
> HTH,
>
>
It does indeed!

I'll probably try and put that in the capo-indicator engraver, but I'm
still trying to get my head around scheme and scheme engravers. I've
grabbed all the examples I can find of scheme engravers but I'm having
difficulty getting to grips with them and they're not much help (they
all seem so inconsistent).

When I get some time to sit down I'll have to send some emails to list
getting you and others to help me learn scheme properly ...

Cheers,
Wol

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Carl Sorensen
On 9/20/10 5:27 PM, "Wols Lists" <[hidden email]> wrote:

>  On 20/09/10 19:57, Carl Sorensen wrote:
>>
>> HTH,
>>
>>
> It does indeed!
>
> I'll probably try and put that in the capo-indicator engraver, but I'm
> still trying to get my head around scheme and scheme engravers.

I think you can get the output you want without an engraver (I know, we've
had this conversation before).  I'd recommend that you update your
modifications to the chord_name_engraver to be based on either two pitches
or a transposition pitch and get all of that working properly.

You can then write a markup that will engrave the capo-indicator, without
having an engraver.  I realize this is not the end goal, but it may be a
useful intermediate point.

> I've
> grabbed all the examples I can find of scheme engravers but I'm having
> difficulty getting to grips with them and they're not much help (they
> all seem so inconsistent).

You will provide a lot of help to present and future frogs if you can write
down your questions as you study engravers, no matter how simple the
questions may be.  Send them to the list for answers, and we will then be
able to add that information to the Contributors' Guide.

>
> When I get some time to sit down I'll have to send some emails to list
> getting you and others to help me learn scheme properly ...

Learning Scheme can be a challenge by itself.  It's probably best to
separate the "learning Scheme" part from the "learning engravers" part.

As far as learning Scheme, may I recommend the online book Structure and
Interpretation of Computer Programs?  It's the book I learned Scheme from.
Lots of examples and interesting exercises.  You can skip the parts you
don't need.  Perhaps most important, IMO, it includes philosophy as well as
techniques.  And sometimes you really need the philosophy in order to
understand what's going on.

You can find it at

<mitpress.mit.edu/sicp/full-text/book/book.html>

Thanks,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Wols Lists
 On 21/09/10 14:22, Carl Sorensen wrote:
> As far as learning Scheme, may I recommend the online book Structure and
> Interpretation of Computer Programs?  It's the book I learned Scheme from.
> Lots of examples and interesting exercises.  You can skip the parts you
> don't need.  Perhaps most important, IMO, it includes philosophy as well as
> techniques.  And sometimes you really need the philosophy in order to
> understand what's going on.
Thanks very much for the pointer. But as it happens, that book is
already open in my browser :-) I've been slowly ploughing through it for
a while, and I think it's helped me look at a scheme program and
understand vaguely what's happening. Just wish I could understand what
the engravers were doing :-)

I've written a sample "starting" engraver, but it consists mostly of
parentheses with no content :-)

Cheers,
Wol

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Wols Lists
In reply to this post by Carl Sorensen
 On 21/09/10 14:22, Carl Sorensen wrote:
> I think you can get the output you want without an engraver (I know, we've
> had this conversation before).  I'd recommend that you update your
> modifications to the chord_name_engraver to be based on either two pitches
> or a transposition pitch and get all of that working properly.
Okay, that'll teach me a bit more. So rather than capoFret, I'll have
capoKey, and just set that to a pitch. I'll then learn how to extract
the key from the key-signature, and calculate the difference. The latter
I think will be easy, the former a bit more tricky :-)

Cheers,
Wol

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Graham Percival
In reply to this post by Wols Lists
On Tue, Sep 21, 2010 at 06:47:42PM +0100, Wols Lists wrote:
> I've written a sample "starting" engraver, but it consists mostly of
> parentheses with no content :-)

Hey, just getting an "empty template" (that compiles) is an
excellent first step!  Please keep track of what you're doing, and
send patches to the Contributor's Guide (programming chapter)
explaining each step.

It won't help you directly, but it will make the next person's
life easier, so they'll be able to start producing patches sooner.
If that person is working on bugfixes or new features that
interest you, it then helps you indirectly.  :)

Also, if an experienced programmer sees a CG patch with material
that they know is wrong (or at least, non-optimal), they might
point it out.  This could give you some direct feedback on your
methods.

Cheers,
- Graham

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Carl Sorensen
In reply to this post by Wols Lists



On 9/21/10 11:50 AM, "Wols Lists" <[hidden email]> wrote:

>  On 21/09/10 14:22, Carl Sorensen wrote:
>> I think you can get the output you want without an engraver (I know, we've
>> had this conversation before).  I'd recommend that you update your
>> modifications to the chord_name_engraver to be based on either two pitches
>> or a transposition pitch and get all of that working properly.
> Okay, that'll teach me a bit more. So rather than capoFret, I'll have
> capoKey, and just set that to a pitch. I'll then learn how to extract
> the key from the key-signature, and calculate the difference. The latter
> I think will be easy, the former a bit more tricky :-)

It might be easier to start with capoPitch (the interval you want to
transpose by) and thus avoid all the difficulties of calculating capoPitch.

Then, if you're interested, you can set capoKey later on.

But whatever you want to do, of course...

Thanks,

Carl


---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Lilypond's internal pitch representation and microtonal notation

Wols Lists
 On 21/09/10 23:31, Carl Sorensen wrote:

>
>
> On 9/21/10 11:50 AM, "Wols Lists" <[hidden email]> wrote:
>
>>  On 21/09/10 14:22, Carl Sorensen wrote:
>>> I think you can get the output you want without an engraver (I know, we've
>>> had this conversation before).  I'd recommend that you update your
>>> modifications to the chord_name_engraver to be based on either two pitches
>>> or a transposition pitch and get all of that working properly.
>> Okay, that'll teach me a bit more. So rather than capoFret, I'll have
>> capoKey, and just set that to a pitch. I'll then learn how to extract
>> the key from the key-signature, and calculate the difference. The latter
>> I think will be easy, the former a bit more tricky :-)
> It might be easier to start with capoPitch (the interval you want to
> transpose by) and thus avoid all the difficulties of calculating capoPitch.
Hmmm. That would be easiest programming wise, of course. But how do I do
that? I guess it would be (for capo 3, say) "set capoPitch = (0, 2, 0)"
to say transpose down a third. But that makes it nasty for the poor user.

Much simpler (from the user's point of view) to say "set capoKey = a",
and if the key signature has already been declared as C (major/minor is
obviously irrelevant :-) I simply subtract c from a (or the other way
round, I'll have to think it through :-) and it all comes neatly together.
> Then, if you're interested, you can set capoKey later on.
>
> But whatever you want to do, of course...
>
>
Now I've got the changes to chord-engraver done, that's the crucial bit.
As you say, the rest could be done with markup. But I'm looking at
making it easy from the user's point of view (plus the learning exercise
for me :-) so the plan was that by creating the capo-indicator-engraver,
it would take care of everything.

So if the capo-indicator-engraver was attached by default (not sure how
you do that :-) all the user need do is say "key = x, capo = y" and
everything just works. Of course, things are rarely that simple :-)

Cheers,
Wol

---
----
Join the Frogs!

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Scheme engraver template [was: Re: [frogs] Re: Lilypond's internal pitch representation and microtonal notation]

Marc Hohl
In reply to this post by Graham Percival
Graham Percival schrieb:

> On Tue, Sep 21, 2010 at 06:47:42PM +0100, Wols Lists wrote:
>  
>> I've written a sample "starting" engraver, but it consists mostly of
>> parentheses with no content :-)
>>    
>
> Hey, just getting an "empty template" (that compiles) is an
> excellent first step!  Please keep track of what you're doing, and
> send patches to the Contributor's Guide (programming chapter)
> explaining each step.
>  
+1

Such an empty scheme engraver would be very valuable indeed!

Marc


---
----
Join the Frogs!

Loading...