moinejf/abc2svg

issues with playing abc tune w/ multiple voices

Opened this issue · 8 comments

I'm trying to play an abc tune with multiple voices but the play.html its throwings errors. Please see this jsbin. I just replaced the abc tune in the play.html example.

Classical (X)HTML problem with foreign data: when there are reserved characters, you must use CDATA sequences.

I wrapped the abc in CDATA tag but its still throwing those errors. My issues are with the playback though. The sound still plays but it doesn't sound right. A lot of notes are out of time and pitch. So I thought it may be related to those errors.

If there are errors, playing will not work.
The CDATA sequence must start and stop in a ABC comment:

%abc2-2
%<![CDATA[
... ABC stuff ...
%]]>

If there are errors, playing will not work.

what do you mean by it won't work? as i mentioned the sound still plays.

The CDATA sequence must start and stop in a ABC comment:

i tried this but it still throws errors. you can see the changes in the same jsbin

  1. Playing is what is displayed. If there are error while displaying, playing will have errors.
  2. I don't see any CDATA in the file.
bwl21 commented

Shouldn't he add the abc in a div etc. as well? in the GIST it is plain text somewhere, but has no HTML - Element around it, so it is not a single dom node.

The ABC source is parsed from the raw body text content before the page is rendered. So, it may be anywhere, in the body or in any node of the DOM.
Then, the whole body source is re-written replacing each ABC fragment by SVG images as blocks.
The problem with the HTML reserved characters is due to HTML parsing by the web browser.

Recently, I found informations about CDATA. It is working for XHTML only (not HTML) and, also, it will soon be deprecated.
But I found that reserved characters work with simple comments:

%abc2-2
%<!--
... ABC stuff ...
%-->

The only constraint is that there cannot 2 dashes ('--') in the ABC sequence (this could occur in lyrics).