abcjs: an in-browser abc renderer

Oxymorons "R" Us
Forum rules
Please see forum announcement for description and rules!
User avatar
s1m0n
Posts: 10069
Joined: Wed Oct 06, 2004 12:17 am
antispam: No
Please enter the next number in sequence: 10
Location: The Inside Passage

Re: abcjs: an in-browser abc renderer

Post by s1m0n »

I have quicktime disabled, so the answer is no. I also have plugins disabled by default in Opera. If I enable plugins in general and reload the page, I get an error telling me that quicktime failed to initialize.
And now there was no doubt that the trees were really moving - moving in and out through one another as if in a complicated country dance. ('And I suppose,' thought Lucy, 'when trees dance, it must be a very, very country dance indeed.')

C.S. Lewis
Tirno
Posts: 47
Joined: Mon Jan 08, 2007 7:07 am

Re: abcjs: an in-browser abc renderer

Post by Tirno »

I'll have a go at making it into a greasemonkey script. I'll also create a user script version for opera, which checks it's not already installed on the page (otherwise you'll get everything rendering twice).

Greg
cboody
Posts: 676
Joined: Sat Nov 21, 2009 10:45 pm
antispam: No

Re: abcjs: an in-browser abc renderer

Post by cboody »

Very interested in the Greasemonkey extension idea. I've a a Mac and some experience (lots of years in fact) of programming PM me if I can be helpful in any way with the testing.
User avatar
s1m0n
Posts: 10069
Joined: Wed Oct 06, 2004 12:17 am
antispam: No
Please enter the next number in sequence: 10
Location: The Inside Passage

Re: abcjs: an in-browser abc renderer

Post by s1m0n »

When I try the Opera version at the session, I'm only seeing the first four bars. Below are the screenshots for the ABC and Sheetmusic tabs of the same tune. On the ABC page abcjs supplies a stave and the first four bars only. It's doing this with all the tunes I've tried.

Image

Image
And now there was no doubt that the trees were really moving - moving in and out through one another as if in a complicated country dance. ('And I suppose,' thought Lucy, 'when trees dance, it must be a very, very country dance indeed.')

C.S. Lewis
User avatar
s1m0n
Posts: 10069
Joined: Wed Oct 06, 2004 12:17 am
antispam: No
Please enter the next number in sequence: 10
Location: The Inside Passage

Re: abcjs: an in-browser abc renderer

Post by s1m0n »

Now that I think about, my guess is that the session's pages are coded with a hard div or table for that box, and the remaining lines exceed it.
And now there was no doubt that the trees were really moving - moving in and out through one another as if in a complicated country dance. ('And I suppose,' thought Lucy, 'when trees dance, it must be a very, very country dance indeed.')

C.S. Lewis
User avatar
hans
Posts: 2259
Joined: Fri Nov 01, 2002 6:00 pm
antispam: No
Please enter the next number in sequence: 8
Tell us something.: I've been making whistles since 2010 in my tiny workshop at my home. I've been playing whistle since teenage times.
Location: Moray Firth, Scotland
Contact:

Re: abcjs: an in-browser abc renderer

Post by hans »

On sessionorg there are empty lines between the abc note lines in the HTML source.
abcjs stops interpreting text as a tune with the first empty line it finds after the initial X: field, it does not want empty lines within one tune. At least that's how I understand it.
User avatar
squidgirl
Posts: 398
Joined: Mon Jul 05, 2004 1:51 pm
antispam: No
Please enter the next number in sequence: 8
Location: Portland, Oregon (USA)

Re: abcjs: an in-browser abc renderer

Post by squidgirl »

Can someone guide me on how to install this script into Firefox for Mac? I can't find a place to tell it where to look for javascripts I want it to use.

Or is there a way to turn this into a bookmarklet, so I could activate it myself when I ran across abc in a page?
cephalopods => weirdly intelligent
cboody
Posts: 676
Joined: Sat Nov 21, 2009 10:45 pm
antispam: No

Re: abcjs: an in-browser abc renderer

Post by cboody »

I set up Opera (on the Mac) and tried the abcjs plugin as mentioned above. I found these things which might be of use to the developers or to others.

1) Most of thesession.org tunes show only the first line, but interestingly enough at least one (Maid Behind the Bar) shows the entire tune. Midi playback appears in every case, playing only what is seen. This is discussed above.

2) On the Nottingham Data Base everything works fine if you tell the display mechanism that you want to see the abc file. I was unable to print just the notation though. There was some discussion of that above. I'll have to read it again.

3) At the Old Music Project you can display the abc of single tunes, but the abcjs browser doesn't do anything. Apparently there are multiple ways of loading a page and the javascript only gets activated under certain circumstances.

4) Any time I displayed an entire file of tunes abcjs did nothing. I suppose this is reasonable, but having all those tunes visible with midi would be fun!

5) The notation is certainly acceptable, but I really missed the ability to print just the notation, and I missed a "button" that would create a .ps or pdf file for download. I suppose that is sort of outside the scope of the project, but it would be nice!

A great start folks. These comments are intended to help and not complain.
User avatar
hans
Posts: 2259
Joined: Fri Nov 01, 2002 6:00 pm
antispam: No
Please enter the next number in sequence: 8
Tell us something.: I've been making whistles since 2010 in my tiny workshop at my home. I've been playing whistle since teenage times.
Location: Moray Firth, Scotland
Contact:

Re: abcjs: an in-browser abc renderer

Post by hans »

squidgirl wrote:Can someone guide me on how to install this script into Firefox for Mac? I can't find a place to tell it where to look for javascripts I want it to use.

Or is there a way to turn this into a bookmarklet, so I could activate it myself when I ran across abc in a page?
It is not possible with Firefox in general, as it is with Opera.
With the Greasemonkey add-on one could run user javascript, but the scripts need to be modified to satisfy Greasemonkey's high security standard. Wait till Greg publishes a Greasemonkey version of the abcjs plugin.

Re bookmarklet: the abcjs plugin is designed to render any abc notation it finds automatically. There is no need for a link to activate it. If it is loaded, preferably by the site, or alternatively as a browser user script, it is already active. The problem is how to load it for sites which do not use it, like C&F here. A bookmarklet would not be able to load it, because you would not want to put ~300Kb of code into a link.
User avatar
hans
Posts: 2259
Joined: Fri Nov 01, 2002 6:00 pm
antispam: No
Please enter the next number in sequence: 8
Tell us something.: I've been making whistles since 2010 in my tiny workshop at my home. I've been playing whistle since teenage times.
Location: Moray Firth, Scotland
Contact:

Re: abcjs: an in-browser abc renderer

Post by hans »

cboody wrote:I set up Opera (on the Mac) and tried the abcjs plugin as mentioned above. I found these things which might be of use to the developers or to others.
.......
Bear in mind that abcjs is a tool primarily intended for website developers, to be integrated with the web pages. To use the plugin as a user javascript is at most a second best, and will never achieve what is possible if it would be properly integrated with the site.

This is especially true for the print options you are looking for. I managed a fair bit of integration with the AbcTunebook add-on for PmWiki. For instance this page http://softflow.org/music/Tunebook/Wood ... Collection has a file full of abc tunes pasted as page content. Click a few to see the score rendering, then click File>Preview, and you see you only get the scores to print of the tunes you "opened", so you can print a selection directly from the page.

You can also see that the abcjs plugin manages to render multiple tunes. By default it is set up to render up to 20 tunes. If there are more it will display tunes as links, and the rendering will take place when a link is clicked. This way it won't take forever to get a page with loads of tunes displayed.
cboody
Posts: 676
Joined: Sat Nov 21, 2009 10:45 pm
antispam: No

Re: abcjs: an in-browser abc renderer

Post by cboody »

Bear in mind that abcjs is a tool primarily intended for website developers, to be integrated with the web pages. To use the plugin as a user javascript is at most a second best, and will never achieve what is possible if it would be properly integrated with the site....
I definitely understand that. I'm just reporting things I noticed and things that occurred to me. As a long time software developer I know that often such comments by others helped me to produce a better product.

I certainly understand the limitation to 20 tunes, but as I noted above there seem to be pages where, whether a single tune or a set of tunes nothing got rendered. I find this curious and wonder what the explanation is.
cboody
Posts: 676
Joined: Sat Nov 21, 2009 10:45 pm
antispam: No

Re: abcjs: an in-browser abc renderer

Post by cboody »

Click a few to see the score rendering, then click File>Preview, and you see you only get the scores to print of the tunes you "opened",
I gave this a try, and noticed that the midi playback window shows up along with the tune itself. Perhaps there is a coding error there?

BTW, if you like I can take these comments off list if you PM me with an email address. I do want to be helpful, and I always feel that noting this sort of thing in a public forum is very unfair to the hardworking developers...of which you are one!
User avatar
hans
Posts: 2259
Joined: Fri Nov 01, 2002 6:00 pm
antispam: No
Please enter the next number in sequence: 8
Tell us something.: I've been making whistles since 2010 in my tiny workshop at my home. I've been playing whistle since teenage times.
Location: Moray Firth, Scotland
Contact:

Re: abcjs: an in-browser abc renderer

Post by hans »

Just to clarify: I am not the developer of abcjs, but of an add-on for PmWiki, which integrates abcjs with PmWiki. My demo site uses this, and in fact uses a slightly modified version of the abcjs plugin, which in particular hides the abc text and shows it only when clicking a link.

The score rendering and the midi player showing together is the default behaviour for the plugin, there is an option in abcjs to turn the midi off entirely, but no coding to show separate links for score rendering and midi player.
timkoozin
Posts: 2
Joined: Thu Jun 02, 2011 9:48 am
antispam: No
Please enter the next number in sequence: 12

Re: abcjs: an in-browser abc renderer

Post by timkoozin »

[ Revival - Mod ]

Abcjs seems to be a very fine tool, but I am unable to control margins and page size. I would like to trim the large white space around the staff. I want no title line and would like to remove the extra space for the title. This seems like a necessary thing in order to add music notation to a web page in a compact layout.

%%staffwidth works fine, but when I try to add other formatting controls they are ignored. (%%topmargin, %%botmargin, %%pageheight, etc.)

Here is my input:
X: 1
M: none
L: 1/8
K: Cmaj
%%staffwidth 12cm
G8 A8 B8 c8 d8 e8^f8 g8 |

I am using abcjs_editor_1.0.5-min.js with Mac and Firefox 3.6 /Safari 4.1 browsers.

Any help would be greatly appreciated. Can anyone provide an example that shows use of margin formatting?
Tirno
Posts: 47
Joined: Mon Jan 08, 2007 7:07 am

Re: abcjs: an in-browser abc renderer

Post by Tirno »

Hi Tim

Margins are something that we will fix for our next release. Hopefully some time over the summer

Greg
Post Reply