Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread N. Andrew Walsh
sorry. You have to switch to the just-intonation-stub branch, which is
here:
https://github.com/openlilylib/snippets/tree/just-intonation-stub/notation-snippets

Cheers,

A

On Sun, Dec 13, 2015 at 10:13 AM,  wrote:

> On Sun, 13 Dec 2015, N. Andrew Walsh wrote:
> > Actually, coverting between the ratios and semitones has alread been
> done,
> > as there's a simple set of log and mround functions that do it. Have a
> look
> > in the OLL repository under notation-tools and you should find the .ily
>
> At what URL?  I'm looking in https://github.com/openlilylib/openlilylib
> and can't find a directory called "notation-tools" at all, nor this kind
> of code in the directories that do exist.
>
> --
> Matthew Skala
> msk...@ansuz.sooke.bc.ca People before principles.
> http://ansuz.sooke.bc.ca/
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread Graham Breed

From: "N. Andrew Walsh"



Actually, coverting between the ratios and semitones has alread been done,
as there's a simple set of log and mround functions that do it. Have a look
in the OLL repository under notation-tools and you should find the .ily
files.


What's the OLL repository?


 Graham

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


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread mskala
On Sun, 13 Dec 2015, N. Andrew Walsh wrote:
> Actually, coverting between the ratios and semitones has alread been done,
> as there's a simple set of log and mround functions that do it. Have a look
> in the OLL repository under notation-tools and you should find the .ily

At what URL?  I'm looking in https://github.com/openlilylib/openlilylib
and can't find a directory called "notation-tools" at all, nor this kind
of code in the directories that do exist.

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread Graham Breed

From: Urs Liska



>Maybe so, but the result is less portable because (if I understand
>correctly) you'd have to have a custom font and have it installed
>correctly, etc. for anyone to be able to use the glyph...  as opposed
>to just having the custom glyphs in an include file that you?re going
>to be including anyway.
>
>-Paul

I think the font idea*may*  be an approach worth considering.

Our stuff will reside in a library anyway, and I think it should be possible to 
have that library call a font reliably when it is in the same directory IIRC.


I can get fonts from the current directory no problem on Linux.  But 
there's a problem with Windows that I still haven't looked into. 
There's surely a way around it, though.



We could then have a font with glyphs for each constituent of your accidentals 
and construct the actual accidental as a markup using \combine, which should be 
pretty straightforward.


If the glyphs are pre-built, a font file is the obvious place to store 
them.  If they have to be combined, it's a bit harder because it has to 
be a text font, but this problem is also solved.  There's a problem with 
more recent Lilyponds where the accidentals can collide with barlines, 
but if you can pin it down and report it I'm sure that can be fixed.  I 
think the rules for combining symbols into glyphs can all be written 
into the font files but that may not be the easiest way to do it.


The nice thing about fonts, though, is that some already exist.  The 
problems with generating large lookup tables, or multiplying ratios, or 
factorizing this or that, can all be solved with the Extended 
Helmholtz-Ellis JI system, and when everything's working you can drop 
the new glyphs or start drawing them some other way.


It's nice that you think keeping the primes distinct is straightforward. 
 I thought it was difficult, especially if you want MIDI playback and 
transpositions to be correct, but not impossible.


A large lookup table, corresponding to a sensible equal temperament for 
wraparound, is probably the best way to get started.  The system is 
potentially infinite, but you can set limits on how far you expect 
modulation to go.  People keep being pessimistic about Lilypond or 
Scheme's performance with large tables but so far nobody's produced a 
huge table and demonstrated it to be unacceptably slow.



  Graham


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


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread Johan Vromans
On Sun, 13 Dec 2015 15:55:08 +0100
"N. Andrew Walsh"  wrote:

> So I've kludged around with Inkscape, and I'm attaching a few .svg files
> to show what I'm getting at. These are *very ugly*, and I would want to
> spend a good bit of time working on proportion, weighting, etc..

Please, please, use a font editor like fontforge. It has all the tools
built in to deal with proportion, weighting, kerning, combining, and so on.
Learning how to use fontforge will pay back quickly.

If you want you can still export individual glyphs as svg.

-- Johan

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


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread N. Andrew Walsh
See the previous message from me, which links to it and provides
instructions for its use.

Cheers,

A

On Sun, Dec 13, 2015 at 1:04 PM, Graham Breed  wrote:

> From: "N. Andrew Walsh"
>>
>
> Actually, coverting between the ratios and semitones has alread been done,
>> as there's a simple set of log and mround functions that do it. Have a
>> look
>> in the OLL repository under notation-tools and you should find the .ily
>> files.
>>
>
> What's the OLL repository?
>
>
>  Graham
>
>
> ___
> 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: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-13 Thread N. Andrew Walsh
So I've kludged around with Inkscape, and I'm attaching a few .svg files to
show what I'm getting at. These are *very ugly*, and I would want to spend
a good bit of time working on proportion, weighting, etc..

However, these are the components to build any accidental within a 7-limit
system: a vertical line, components for the primes 3, 5, and 7, and the
unique accidental for the tonic. The vertical is the file "000.svg", and
all the rest should be clear.

I don't know enough about making fonts to know how these would work as part
of a font file. They would need hinting for ordering and collision
avoidance, keeping in mind that there could potentially exits ratios
requiring many more of each of these modules (for example, 49/45 would have
two of the 007 on top, and two of 003 and one of 005 on the bottom. It
would thus probably need to expand vertically somewhat).

Anyway, now that I have some svg files, I suppose I can get to working with
fiddling with the scaling for Lily.

Cheers,

A

On Sun, Dec 13, 2015 at 2:04 PM, Graham Breed  wrote:

> From: Urs Liska
>>
>
> >Maybe so, but the result is less portable because (if I understand
>>> >correctly) you'd have to have a custom font and have it installed
>>> >correctly, etc. for anyone to be able to use the glyph...  as opposed
>>> >to just having the custom glyphs in an include file that you?re going
>>> >to be including anyway.
>>> >
>>> >-Paul
>>>
>> I think the font idea*may*  be an approach worth considering.
>>
>> Our stuff will reside in a library anyway, and I think it should be
>> possible to have that library call a font reliably when it is in the same
>> directory IIRC.
>>
>
> I can get fonts from the current directory no problem on Linux.  But
> there's a problem with Windows that I still haven't looked into. There's
> surely a way around it, though.
>
> We could then have a font with glyphs for each constituent of your
>> accidentals and construct the actual accidental as a markup using \combine,
>> which should be pretty straightforward.
>>
>
> If the glyphs are pre-built, a font file is the obvious place to store
> them.  If they have to be combined, it's a bit harder because it has to be
> a text font, but this problem is also solved.  There's a problem with more
> recent Lilyponds where the accidentals can collide with barlines, but if
> you can pin it down and report it I'm sure that can be fixed.  I think the
> rules for combining symbols into glyphs can all be written into the font
> files but that may not be the easiest way to do it.
>
> The nice thing about fonts, though, is that some already exist.  The
> problems with generating large lookup tables, or multiplying ratios, or
> factorizing this or that, can all be solved with the Extended
> Helmholtz-Ellis JI system, and when everything's working you can drop the
> new glyphs or start drawing them some other way.
>
> It's nice that you think keeping the primes distinct is straightforward.
> I thought it was difficult, especially if you want MIDI playback and
> transpositions to be correct, but not impossible.
>
> A large lookup table, corresponding to a sensible equal temperament for
> wraparound, is probably the best way to get started.  The system is
> potentially infinite, but you can set limits on how far you expect
> modulation to go.  People keep being pessimistic about Lilypond or Scheme's
> performance with large tables but so far nobody's produced a huge table and
> demonstrated it to be unacceptably slow.
>
>
>
>   Graham
>
>
> ___
> 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: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread N. Andrew Walsh
Actually, coverting between the ratios and semitones has alread been done,
as there's a simple set of log and mround functions that do it. Have a look
in the OLL repository under notation-tools and you should find the .ily
files.

Cheers,

A

On Sun, Dec 13, 2015 at 7:51 AM,  wrote:

> On Sat, 12 Dec 2015, N. Andrew Walsh wrote:
> > accidentals as needed. I suppose, rather than having Lily/Scheme
> calculate
> > prime factors on the fly at runtime, it would be easier to have a lookup
> > table of the prime factorization for each integer up to a certain limit
> (but
> > that would end up being very high, so maybe not). That's a computational
> > problem for further down the road, though.
>
> For numbers of 32 bits or so, doing prime factorization by simple-minded
> trial and error on a present-day computer is cheaper than most people
> realize.  It's a tight loop that fits in cache; the arithmetic may
> actually be faster than a lookup table in main memory, and it's at least
> unlikely to be prohibitively slow.
>
> I think a trickier computational problem may be converting between
> LilyPond's "rational number of semitones" and just-intonation's "rational
> ratio of frequencies" ways to express pitch.  Because of the log function
> in between, in general any number that has a representation on one of
> those scales will have no exact representation on the other, and you're
> forced to do some kind of rounding, or maybe abandon LilyPond's pitch
> scheme for something else.  Have you decided how you want to deal with
> this issue yet?
>
> --
> Matthew Skala
> msk...@ansuz.sooke.bc.ca People before principles.
> http://ansuz.sooke.bc.ca/
>
___
lilypond-user mailing list
lilypond-user@gnu.org
https://lists.gnu.org/mailman/listinfo/lilypond-user


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread mskala
On Sat, 12 Dec 2015, N. Andrew Walsh wrote:
> accidentals as needed. I suppose, rather than having Lily/Scheme calculate
> prime factors on the fly at runtime, it would be easier to have a lookup
> table of the prime factorization for each integer up to a certain limit (but
> that would end up being very high, so maybe not). That's a computational
> problem for further down the road, though.

For numbers of 32 bits or so, doing prime factorization by simple-minded
trial and error on a present-day computer is cheaper than most people
realize.  It's a tight loop that fits in cache; the arithmetic may
actually be faster than a lookup table in main memory, and it's at least
unlikely to be prohibitively slow.

I think a trickier computational problem may be converting between
LilyPond's "rational number of semitones" and just-intonation's "rational
ratio of frequencies" ways to express pitch.  Because of the log function
in between, in general any number that has a representation on one of
those scales will have no exact representation on the other, and you're
forced to do some kind of rounding, or maybe abandon LilyPond's pitch
scheme for something else.  Have you decided how you want to deal with
this issue yet?

-- 
Matthew Skala
msk...@ansuz.sooke.bc.ca People before principles.
http://ansuz.sooke.bc.ca/

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


converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread Paul Morris
Hi Andrew,

> On Dec 12, 2015, at 10:38 AM, N. Andrew Walsh  
> wrote:
> 
> I've been doing some background work on my just-intonation accidentals, and I 
> was hoping you could give me some advice on the svg-to-path translation. I 
> know what the stencils should look like, but I'm not sure about things like 
> scaling (how many units high or wide should a stencil have if it's 
> equivalent, say, to the thick bars in a sharp sign?), and what the best 
> procedure might be for drawing them. Could you give me some advice/help? 
> 
> I think this is going to be geared towards adding into the OLL repository as 
> part of the "contemporary notation" extensions, so probably aimed at the dev 
> branch. So I'll see about the make-path-stencil (are you sure it's that and 
> not the "make-connected-path-stencil" I see in the LSR?).


Here’s what I’d suggest for going from an svg to a path from my experience with 
doing this.  

You can create a simple .ly file with a few notes and accidentals, then render 
it to SVG and open that SVG in Inkscape.  Then use Inkscape to draw your 
accidentals (or parts of accidentals) so they look good next to the notes and 
standard accidentals.  Having the default notes, accidentals, staff, in the SVG 
will help you get it at approximately the right scale.  (Although this may not 
matter, you will probably have to change the scaling later anyway…  I can’t 
remember for sure.)

Cut and paste your shape into a separate Inkscape SVG file and export/save as a 
plain SVG.  I found that I had to horizontally flip the shape in Inkscape first 
because svgs from Inkscape apparently come out reversed for some reason.  So 
you may need to do that.

Open that SVG file in a text editor and find the path data.  It should look 
something like this (a custom whole note glyph I made):



Working with this is the tedious part…  You can take out the parts you don’t 
need.  Here’s the part you do need:

d="m 304.96006,540.93655 c 11.66747,0 16.5678,6.05308 16.5678,16.78715 
0,18.43458 -14.00096,28.9213 -32.43555,28.9213 -11.66747,0 -16.33444,-6.05308 
-16.33444,-16.78715 0,-18.43458 13.7676,-28.9213 32.20219,-28.9213 z m 
-66.27119,22.85423 c 0,10.03402 7.93387,17.50119 17.0345,22.40152 
12.60086,6.76713 27.06851,9.33397 41.30282,9.33397 14.23429,0 28.9353,-2.56684 
41.53616,-9.33397 9.10063,-4.90033 17.0345,-12.3675 17.0345,-22.40152 
0,-10.03402 -7.93387,-17.5012 -17.0345,-22.40153 -12.60086,-6.76713 
-27.30186,-9.33397 -41.53616,-9.33397 -14.23431,0 -28.70196,2.56684 
-41.30282,9.33397 -9.10063,4.90033 -17.0345,12.36751 -17.0345,22.40153 z"

You can manually reformat that so it is easier to read and then use something 
like
http://petercollingridge.appspot.com/svg_transforms 

to transform the path in various ways. 

For example the following is scaled using "scale(0.016, 0.016)" and converted 
to absolute coordinates.  It may help to look up "SVG path" on the web to get 
familiar with the commands C c M m z and the possible transformations, etc.



You might want to shift / translate it so it is snug to (0,0) with 
“translate(x, y)” where x and y are the inverse of the smallest X and Y values 
in the path.  (I did this, but it may not be necessary…)

Now you have a path that can be used by “make-path-stencil”.  It will look 
something like the following as embedded scheme in a LilyPond file:

#(define whole-note-outline
'(M 0 0
   C 0 0.16054432 0.12694192 0.28001904 0.272552 0.35842432
   C 0.47416576 0.4666984 0.70564816 0.50776784 0.93339712 0.50776784
   C 1.16114576 0.50776784 1.39636192 0.4666984 1.59797568 0.35842432
   C 1.74358576 0.28001904 1.87052768 0.16054432 1.87052768 0
   C 1.87052768 -0.16054432 1.74358576 -0.2800192 1.59797568 -0.35842448
   C 1.39636192 -0.46669856 1.16114592 -0.507768 0.93339712 -0.507768
   C 0.70564816 -0.507768 0.47416576 -0.46669856 0.272552 -0.35842448
   C 0.12694192 -0.2800192 0 -0.16054432 0 0
   z))

Then you can use it like so:

  (make-path-stencil whole-note-outline 0.0001 1 1 #t)

in the scheme code you’re using to override the accidental glyphs.  The 
arguments are:

(make-path-stencil 
path-data-list 
thickness-of-path-line
x-scale-factor 
y-scale-factor 
filled-or-not)

(Oh, and yes make-path-stencil is what I'd use if you’re targeting 2.19 or 
higher.  The make-connected-path-stencil procedure is similar but more limited. 
 make-path-stencil is not in the LSR yet...)

To get the scaling right is basically a trial and error dance.  Use the scale 
factor arguments to test until you’ve got it right, then go back and scale the 
path data itself with those values so it’s the correct size to start with.  
(You could go back to Inkscape and scale there if you prefer…)

…so you’ll need some scheme code for overriding the standard accidental 
stencils with your path stencils.  (It might make sense to just create some 
simple line 

Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread Johan Vromans
> Anyway, that’s how I’ve done this kind of thing.  It’s not simple but it
> works!

If I understand the procedure correctly, wouldn't it be easier to use a
tool like fontforge add/adjust font glyphs?

-- Johan

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


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread Urs Liska


Am 12. Dezember 2015 23:08:53 MEZ, schrieb Paul Morris :
>> On Dec 12, 2015, at 3:34 PM, Johan Vromans 
>wrote:
>> 
>> If I understand the procedure correctly, wouldn't it be easier to use
>a
>> tool like fontforge add/adjust font glyphs?
>
>Maybe so, but the result is less portable because (if I understand
>correctly) you'd have to have a custom font and have it installed
>correctly, etc. for anyone to be able to use the glyph...  as opposed
>to just having the custom glyphs in an include file that you’re going
>to be including anyway.  
>
>-Paul

I think the font idea *may* be an approach worth considering.

Our stuff will reside in a library anyway, and I think it should be possible to 
have that library call a font reliably when it is in the same directory IIRC.

We could then have a font with glyphs for each constituent of your accidentals 
and construct the actual accidental as a markup using \combine, which should be 
pretty straightforward.

Urs

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

-- 
Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail gesendet.

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


Re: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread N. Andrew Walsh
It would not, because the accidentals I use are in an open system of just
intonation (not a fixed scale) in which *any* conceivable ratio can be
represented (so long as I have the module for its respective prime
factors). This is a serious limitation of a lot of systems, in that the
moment you start getting into primes above, say, 17 (or even to certain
combinations of them), there are no accidentals to represent them, and
you're back to using numbers in markups.

My endgame here is to make stencils for each prime factor up to 512 (so,
2^10, thus ten octaves, of which there are about 100 primes [which seems
felicitous]), so that you can represent any conceivable fraction up to a
ridiculous complexity, on the fly, within Lily.

In that context, it makes much more sense (so far as I can tell) to make
individual stencils for each prime, and then arrange them for the
accidentals as needed. I suppose, rather than having Lily/Scheme calculate
prime factors on the fly at runtime, it would be easier to have a lookup
table of the prime factorization for each integer up to a certain limit
(but that would end up being very high, so maybe not). That's a
computational problem for further down the road, though.

For now, I'll get to fiddling with Inkscape and trying to make some
stencils, so I can at least show what I'm talking about.

Cheers,

A

On Sat, Dec 12, 2015 at 9:34 PM, Johan Vromans  wrote:

> > Anyway, that’s how I’ve done this kind of thing.  It’s not simple but it
> > works!
>
> If I understand the procedure correctly, wouldn't it be easier to use a
> tool like fontforge add/adjust font glyphs?
>
> -- Johan
>
> ___
> 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: converting svg glyph to path data for use in scheme (was: accidentals for just intonation)

2015-12-12 Thread Paul Morris
> On Dec 12, 2015, at 3:34 PM, Johan Vromans  wrote:
> 
> If I understand the procedure correctly, wouldn't it be easier to use a
> tool like fontforge add/adjust font glyphs?

Maybe so, but the result is less portable because (if I understand correctly) 
you'd have to have a custom font and have it installed correctly, etc. for 
anyone to be able to use the glyph...  as opposed to just having the custom 
glyphs in an include file that you’re going to be including anyway.  

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