I have a page with two textareas to read and parse something called "ABC" music notation, a text used to enter mostly west European folk songs such as this:
Code:
X:1
T:Speed the Plough
M:4/4
C:Trad.
K:G
|:GABc dedB|dedB dedB|c2ec B2dB|c2A2 A2BA|
  GABc dedB|dedB dedB|c2ec B2dB|A2F2 G4:|
|:g2gf gdBd|g2f2 e2d2|c2ec B2dB|c2A2 A2df|
  g2gf g2Bd|g2f2 e2d2|c2ec B2dB|A2F2 G4:|
While it is parsing it, it builds a two dimension array used to create the text in the other textarea in a new format.

The problem comes when the music has more than one "voice" and has more than one staff at a time such as here
Code:
[V:1]|:aga|bag|f/e/f/g/f/g/|a/g/a/b/a/b/|!
[V:2]|:fef|gfg|a/g/a/b/a/g/|f/e/f/g/f/g/|
%
[V:1]aga|bag|a3/4b/4g3/2a/|a3:|
[V:2]fef|gfe|f3/4g/4 e>f|f3:|
The voices here are 1 and 2, but the labels could be anything and stay in effect until another V: changes them. The problem is the new format demands that one staff be completely built before starting on another one. It would need to look only at V1 entries before doing only V2's.

Is there any way to avoid creating a 3rd dimension in my work array for this to still work? For reference my page is here.htm and the standard is abcstandard.htm.

Thanks in advance.