Melodeon.net Forums

Discussions => Tunes => ABC => Topic started by: Dave Sawdon on February 26, 2020, 03:39:05 PM

Title: Generating incipits with easyABC
Post by: Dave Sawdon on February 26, 2020, 03:39:05 PM
I can print scores OK but have never been able to successfully generate an incipits file.
If I "generate incipits file" (with default settings) I get 4 bars of a tune on each page.
If I "view incipits" I get a blank page, then a page with the title of the first tune, then a 2-column page of incipits (with the last one truncated), then a blank page, then a page with the title of the next tune ... etcetera.
I can't see anything wrong with the notation so I'd be very grateful if someone would volunteer to try generating incipits from the attached file. If this gives the same problem I know to look more deeply into the file, and if it works I know to look elsewhere.
Any volunteers to look at the attached file?
Title: Re: Generating incipits with easyABC
Post by: Anahata on February 26, 2020, 04:04:17 PM
I know nothing about the incipit generator, but that I'm pretty sure that file isn't standard ABC as there should be a blank line between each tune.

(PS: Yes - from the ABC standard 2.1 "An abc tune itself consists of a tune header and a tune body, terminated by an empty line or the end of the file. ")

So that's worth a try for a start.
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 26, 2020, 04:34:19 PM
Thanks for the suggestion - I think I took the carriage returns out when I last tried to fix this. I've just put them back and get the same results. I also spotted an unwanted space in an X line that had snuck-in from somewhere, but deleting that also did nothing to help the problem.
I'll attach the revised file.
Title: Re: Generating incipits with easyABC
Post by: Tone Dumb Greg on February 26, 2020, 05:35:42 PM
Anahata's fix worked OK for me, in EasyABC.

Bye the bye, your collection looks extraordinarily like my  collection of session tunes. Some of your sets look fun, as well.
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 26, 2020, 06:38:11 PM
Hmmm, after a bit more experimenting the problem seems to only be associated with selecting "2 column output", which is when EasyABC inserts the following at the start of the incipits file:
Quote
%%topspace 0.0cm
%%staffsep 0.7cm
%%titleformat T-1
%%maxshrink 1.4
%%musiconly 1
%%printtempo 0
%%titlefont Helvetica-Oblique 16
%%subtitlefont Helvetica-Oblique 13


%%multicol start
%%rightmargin 11.5cm
%%leftmargin 1.5cm
and
Quote
%%multicol end
%%newpage

%%multicol start
%%rightmargin 11.5cm
%%leftmargin 1.5cm
at various points.


(Tone Dumb Greg: I started a steady session about 2 1/2 years ago and have slowly been expanding the repertoire since then; this is the latest tune book)
Title: Re: Generating incipits with easyABC
Post by: Roger Hare on February 27, 2020, 11:55:34 AM
I hope it's OK to mention this - a side issue really - but there's a (3BcBB2 in bar 14 of
Lemmie Brazil's which I think should be (3BcB...
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 27, 2020, 12:06:35 PM
Thanks Roger, all input gratefully received.

Does the file produce a sensible 2-column incipit PDF for you?
Title: Re: Generating incipits with easyABC
Post by: Roger Hare on February 27, 2020, 12:47:03 PM
...Does the file produce a sensible 2-column incipit PDF for you?
Yes, it does, though the pages are filled a little oddly. I have a 5 page incipits PDF
with a single item on the final page, which I am quite sure would fit on the preceding
page. In general, pages seem to be 'not quite filled as much as they could be' - if that
makes sense...

I did this via Tools>Generate incipits file, followed by File>Export all>As PDF book

but Tools>View incipits seems to directly generate and display the same PDF with
the name temp.pdf. I guess I can directly print that, but the file disappears if I exit my PDF
viewer

I haven't really taken it any further than that, but I haven't seen the 'blank page' artefact
which I think you mentioned earlier in this thread.
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 27, 2020, 01:03:34 PM
That's what I've been doing, so it looks as if the problem is not the ABC file. I just tried updating ghostscript and changing the %% commands that easyABC injects, but to no avail.
I'm beginning to wonder whether this is worth the effort.
Title: Re: Generating incipits with easyABC
Post by: Mike Hirst on February 27, 2020, 01:55:57 PM
I am not an easyABC user. I prefer to use the command line. As the back end of easyABC is run using abcm2ps I experimented using the command:

Code: [Select]
sed '/^%abc/s/.*/&\n%%tune .*\n%%clip 1-5/' "Mar 2020.abc"|abcm2ps - -O incipits.ps

to generate the postscript file 'incipits.ps' which I have attached as a pdf. (Converted using ps2pdf.)

Despite a warning re use of the illegal key ref. 'K:Gmaj/Em' in the tune 'T:Rochdale Coconut Dance', I achieved the desired incipit collection without error.

I agree with Ahahata re lack of empty line(s) between tunes. Ordinarily I would use a slightly longer script to add these when working with abc collections that I have not written myself. Significantly I did not have to remove any of the pre-existing embedded abc commands or make any other alterations.

In precise the code printed above adds the lines:

Code: [Select]
%%tune .*
%%clip 1-5

after the '%abc" declaration at the head of the file.

These instruct abcm2ps to select all tunes (%%tune .*) and to print only the measures included between the first and the fifth measure bars (%%clip 1-5). This is then piped to abcm2ps for abc to postscript conversion. In practice I would pipe abcm2ps output to ghostscript to give pdf output, but for the sake of simplicity I have broken things down into what I hope is a clear and simple three step process.
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 27, 2020, 02:10:19 PM
The problem I'm having seems to only be associated with two-column output, can the command line approach be used to generate a 2-column incipits file?
Title: Re: Generating incipits with easyABC
Post by: Mike Hirst on February 27, 2020, 02:52:21 PM
The problem I'm having seems to only be associated with two-column output, can the command line approach be used to generate a 2-column incipits file?

Dunno?? I'll give it a try.
Title: Re: Generating incipits with easyABC
Post by: Gena Crisman on February 27, 2020, 03:06:36 PM
Tools>View Incipits creates a file in a temporary folder which will likely vary by both version of EasyABC And platform, but in my case it's in C:/Users/Gena/AppData/Local/EasyABC/cache/temp.pdf. You could either retrieve the file, or, you could probably also print the pdf to another pdf, again, depending on OS. The file is only replaced when you generate incipits again, so, it's probably still in a very similar folder somewhere on your system.

I should also ask, Dave, what version of EasyABC are you using? Help/About should provide you a version number. This should infer what version of abcm2ps is being used and what it's trying to do.

To actually deal with your problem, though, I think basically the problem is that, %%multicol is a fairly primitive attempt at implementing the idea of how to actually figure out making a multicolumn output - It doesn't know how to deal with page wrapping correctly, and needs to be manually instructed on where to place tunes within the space of a page. You have to manually define new pages, as it can't work out how to wrap, and you have to manually define where position of each column.

Personally, I would advise you don't use that multi column at all, and instead retrofit a solution of your own over the top, such as adding %%scale 2 (or maybe less, to suit your taste) and then using eg google chrome or anything slightly clever to print your PDF 4 pages per sheet. You could also modify the left/right margins etc. I think ignoring easyABC's incipits system and writing extra lines into the header and printing the file as a book is the better choice. That's exactly how I now intend to make an incipits tune book for my morris side, which I've been meaning to do.

If you wish to persisit with it, I'd aim to ensure you know exactly how many rows fit on a given page, and try to use it like that - if a tune wraps strangely or has chord symbols or not etc will all impact how 'tall' a tune is, and probably cause the output file to get messed up, so, it'll be a bit of a game of cat & mouse.
Title: Re: Generating incipits with easyABC
Post by: Gena Crisman on February 27, 2020, 03:22:08 PM
Also, both EasyABC's method and %%clip both seem to have no idea how to deal with multiple tunes added as a set, so, the Set Lists at the end of the file are probably getting butchered.
Title: Re: Generating incipits with easyABC
Post by: Mike Hirst on February 27, 2020, 03:46:36 PM
To actually deal with your problem, though, I think basically the problem is that, %%multicol is a fairly primitive attempt at implementing the idea of how to actually figure out making a multicolumn output - It doesn't know how to deal with page wrapping correctly, and needs to be manually instructed on where to place tunes within the space of a page. You have to manually define new pages, as it can't work out how to wrap, and you have to manually define where position of each column.

Also, both EasyABC's method and %%clip both seem to have no idea how to deal with multiple tunes added as a set, so, the Set Lists at the end of the file are probably getting butchered.

This is exactly what I found.

I can see ways to achieve the desired result, but not without an enormous amount of unnecessary jiggery-pokery.

ABC is great tool for enabling simple exchange of tunes and printing, but for anything complicated it's perhaps not the best thing to use. For fancy formatting svg export and further editing using vector editing tools is a good option for individual tunes, but I don't think it would be much use here.

Maybe lilypond or musicxml would give better options.

BTW looking through the list has reminded me of some good tunes I had forgotten. Thanks for sharing
Title: Re: Generating incipits with easyABC
Post by: Roger Hare on February 27, 2020, 05:05:41 PM
Mea culpa! I should have said - I am using EasyABC 1.3.7.7

<pita on>
I think there may be summat up with bars 5 &21 of Winster Gallop...
<pita off>

...%%multicol is a fairly primitive attempt at implementing the idea of how to actually figure out
making a multicolumn output - It doesn't know how to deal with page wrapping correctly..

I'm not going to be as 'forensic' as Gena, but I agree. I tried to use multi-column output to do the
pseudo-academic references in a mixed text/music ABC document I prepared about a year ago.
I got it to work but it was a nightmare!

Title: Re: Generating incipits with easyABC
Post by: Mike Hirst on February 27, 2020, 05:15:07 PM
I think we are in agreement here.

I suspect the way froward would be to export abc to svg using abcm2ps. svg could be wrapped using html then css can be used to give multi-column (https://www.w3schools.com/css/css3_multiple_columns.asp) output.
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 28, 2020, 09:40:20 PM
SOLVED. Many thanks to everyone.
The simple solution is to use EasyABC to output 1-column incipits, export the resulting file as a PDF book and then print as a booklet (doh! I should have thought of that). The sets will need to go in a separate file, but that's no hardship.

However, I hadn't encountered stylesheet directives until now so spent a while reading through the list of abcm2ps parameters (http://moinejf.free.fr/abcm2ps-doc/index.html) and thought I had enough of an understanding to take control of the incipits generation. My plan was to insert the following directives (commented out) at the start of a collection of tunes and then, when incipits are wanted, to remove the comment markers, export to a PDF book and then print the book as a booklet.
% %%topspace 0.0cm
% %%staffsep .7cm
% %%titleleft 1
% %%titlefont Helvetica-Oblique 16
% %%scale .7
% %%tune .*
% %%clip 1-5
% %%writefields T
% %%maxshrink 0.9
But, the resulting output includes all the T lines for a tune and I can't find a Directive to only include the first T line (which is what EasyABC does when generating the incipits) - what have I missed?

(BTW, I'm using 1.3.7.7 of EasyABC)


Roger: wassup with bars 5 &21 of Winster Gallop...?


Mike: I can (almost) guarantee that you won't have heard of Polca Llewlyn Alaw before - I found it in a Welsh fiddle book and, err, fiddled with it a bit  >:E . If you go to the session website (https://almeleysteadysession.wordpress.com/) you'll find links to recordings for most of the tunes. FWIW I think the most successful tune at the session has been Traveller's Joy.
Title: Re: Generating incipits with easyABC
Post by: Lester on February 28, 2020, 10:17:05 PM

Roger: wassup with bars 5 &21 of Winster Gallop...?

Bar 5 is currently | "C"c2 e/e/  "(D)"g>e | but should be | "C"ce/e/  "(D)"g>e |
Bar 21* is currently | "Am"A2 c/c/ e>c | but should be | "Am"Ac/c/ e>c |

*Bar 5 of the Em version
Title: Re: Generating incipits with easyABC
Post by: Gena Crisman on February 28, 2020, 10:23:17 PM
But, the resulting output includes all the T lines for a tune and I can't find a Directive to only include the first T line (which is what EasyABC does when generating the incipits) - what have I missed?

You could be cheeky and use subtitlefont and %%subtitlespace  and make the font really really tiny. Perhaps try adding

%%subtitlefont serif 1
%%subtitlespace 0cm


To your header. That will give you tiny little lines which will should be less obtrusive. There's also the command titleformat, but, it's weird and based on a few attempts at using it, I suspect it doesn't work if the titles are not all defined before any staves.

Really, though, when you're outputting as a booklet with multiple tunes per page, having your set tunes enclosed within a single X line is working to your disadvantage here, well, barring the fact that they might appear on separate pages otherwise but I think technically that is still true if any given tune can wrap a page, which I think is an option. But, as of current, the other tunes in the set aren't appearing at all, so, I think either you want to generate your incipits with EasyABC without columns, and then add in the missing lines from your set tunes, or, you want to use either clip -5 or clip 1-5 and split your sets up (you can likely use the same X: value, and just duplicate the other params like M and L) and use your current headers.

edit - So, after some fiddling, you could try adding something like

%%titleformat T0 C1 T1 T1
%%composerfont serifItalic 8


to your header - this will push the top-of-file secondary titles off to the side and draw the composer on the same line, so, it's ever so slightly more space efficient. Your additional titles in your sets are still going to be 'there' though, unless you try one of the above. But, it's super primitive and not very clever - if you look at set 2:

T:Set 2: Galopede - Portsmouth
M:4/4
L:1/8
K:G
T:Galopede


The existence of these other commands causes the second title to not be noticed by the format I suggested, and so it still gets drawn centrally. Basically, none of these commands were really designed to work with injecting a 2nd tune inside another one with a separate title halfway down. Perhaps they're considered 'something else'. I guess at this point I should probably just dig into the abcm2ps code (https://github.com/leesavide/abcm2ps/) and figure out how it decides to do what, in this case.
Title: Re: Generating incipits with easyABC
Post by: Dave Sawdon on February 28, 2020, 10:58:34 PM
Lester (and Roger):  :-[ I think the expression is "hiding in plain sight".  :|bl

Gena: I'm happy to put the sets into a separate file and not bother generating incipits for them because the tunes are all in the main session file. The problem comes in a tune that has two names (such as Battle of Prague). EasyABC manages to strip-off the second Title when generating the incipits but I can't see a Directive that will allow me to do that.
Title: Re: Generating incipits with easyABC
Post by: Gena Crisman on February 28, 2020, 11:32:49 PM
Yes - basically, EasyABC is attacking the problem via text analysis of your ABC file, and creating a new ABC file. It's effectively choosing to say, 'oh, we don't need this T: line'. Unfortunately, there's nothing in abcm2ps by default that allows it to actually ignore T: lines in the body of your tune, so even though it would appear you can have it ignore additional titles that live at the top of your tune, you can't hide the ones within the body - the only thing I can think of is just making those secondary titles really small, which seems to work for me?

My full headers to test with are

Code: [Select]
%%topspace 0.0cm
%%staffsep 0.7cm
%%musiconly 1
%%printtempo 0
%%tune .*
%%clip -5
%%maxshrink 1
%%linewarn 0
%%breaklimit 1
%%scale 1
%%botmargin 0.6
%%leftmargin 0.6
%%topmargin 0.6
%%rightmargin 0.6
%%subtitlefont serif 1
%%subtitlespace 0cm
%%titleformat T0 C1 T1 T1
%%composerfont serifItalic 8

and the output is as attached.

Having dug around the code, I'm none the wiser as to how the title format works, but, I can see what it does when it isn't using it and yeah, there doesn't appear to be a 'just don't do it' option. Looks like they're sort of competing ideas. My current inclination is actually to try and reset whatever clip uses to count bar lines whenever it encounters a T: line, which might make it work 'as intended', or, as we'd like it to, here. don't think that's gonna happen, it pretty much manhandles the stream of data in ways I cannot get a handle on from just snippets of the rather large code base.

edit:
OK so, T lines, if they are present BEFORE a K: line in an ABC tune, are considered to be in the 'header' if the tune, and if they are after, they are considered to be part of the tune itself. To our eyes, there's not really any difference but to abcm2ps they're handled by separate code. This is why %%titleformat has no impact on the in body T: entries, and sometimes not in T entries that come before the ABC tune itself but after some other commands, all the while still including the Composer line regardless of it's location. Unfortunately, there is no directive to ignore T entries in the body of the tune.

But, this does mean that it is principally possible for abcm2ps to have its instruction set expanded to support such a request, however, I'd only actually want that because I'd want to make clip's current not ideal function work more appropriately. If however it did clip the 2nd tune in keeping with our desires, then... I would want those titles? So, that seems like the more prudent modification. However, most likely if it was me trying to do this, I'd be modifying the javascript of abc2svg, the project which replaced abcm2ps, just because I'm hoping that it will allow for a different approach than the really quite raw memory copying going on with abcm2ps that I could very easily get completely wrong. But, the actual reality is that, nowadays it's probably much more plausible to write eg a python or php script to attack the ABC code and produce the desired outcome in a much more nuanced way than either EasyABC or abcm2ps currently provide, such as considering how many bars are needed on a meter by meter basis (2/4 vs 4/4 vs 9/8 vs 12/8 might all benefit from different #s of bars being kept. Need to manually override it? Add your own directive to the tune, etc.

A project for another day, though.
Title: Re: Generating incipits with easyABC
Post by: Roger Hare on March 01, 2020, 12:58:02 PM
Roger: wassup with bars 5 &21 of Winster Gallop...?
Sorry, I only just saw this. Both bars are 'over-full'.

I had an idea what to put in there, but I didn't push it because I'm not a real musician, like
most of the folks here. I hoped one of the real musicians would cough up a suggestion, and
Mr. Bailey has obliged.

FWIW, my 'solution' was:
Bar 5: | "C" c/d/e/f/ "(D)"g>e |
Bar 21: | "Am" A/B/c/d/ e>c |
 
SimplePortal 2.3.5 © 2008-2012, SimplePortal