Jump to content

Merging two text files to produce another text file using JS


Nadarajah

Recommended Posts

Hi,

I am new to this forum and have very basic knowledge of js.  I would like to merge/combine two files Melody.abc and Chord.abc to produce Melody+Chord.abc. Content of these files are shown below.

What I have done so far is given in the attachment. Some of you might be able to help me to do this more efficiently. Instead of reading the Melody.abc and Chords.abc I have copied  part of Melody.abc and Chords.abc to the js code itself. I would like to know how to read Melody.abc and Chords.abc from within the coding

Thanks

Thiru

Melody.abc
======
X: 1
T: Twinkle Twinkle Little Star Melody
L: 1/8
M: 1/4
V: RH1 clef=treble
K: C 
[V: RH1]
C2C2 | G2G2|A2A2 | G4|F2F2 | E2E2|D2D2 | C4|
w: Twin kle, twin kle, litt le star, How I won der what you are
[V: RH1]
G2G2 |F2F2  | E2E2| D4 | G2G2| F2F2 | E2E2 | D4 | 
w: Up a- bove the sky so high, like a dia-mond in the sky.
[V: RH1]
C2C2 | G2G2|A2A2 | G4|F2F2 | E2E2|D2D2 | C4|
w: Twin kle, twin kle, litt le star, How I won der what you are
 
Chord.abc
======
X: 1
T: Chords for Twinkle Twinkle Little Star
L: 1/8
M: 1/4
V: LH1 clef=bass
K: C 
[V: LH1]
[C,E,G,]4 | [[C,E,G,]4|[F,,A,,C,]4 | [C,E,G,]4|[F,,A,,C,]4 |[C,E,G,]4|[G,,B,,D,]4|[C,E,G,]4|
[[V: LH1]
[C,E,G,]4|[F,,A,,C,]4 | [C,E,G,]4 |[G,,B,,D,]4 | [C,E,G,]4| [F,,A,,C,]4 |[C,E,G,]4 | [G,,B,,D,]4 | 
[V: LH1]
[C,E,G,]4 | [C,E,G,]4|[F,,A,,C,]4|[C,E,G,]4|[C,E,G,]4 | [C,E,G,]4|[F,,A,,C,]4 | [G,,B,,D,]4|
 
JS code should produce this Melody+Chord.abc from the above two
X: 1
T: Twinkle Twinkle Little Star
L: 1/8
M: 1/4
V: RH1 clef=treble
V: LH1 clef=bass
K: C 
[V: RH1]
C2C2 | G2G2|A2A2 | G4|F2F2 | E2E2|D2D2 | C4|
w: Twin kle, twin kle, litt le star, How I won der what you are
[V: LH1]
[C,E,G,]4 | [[C,E,G,]4|[F,,A,,C,]4 | [C,E,G,]4|[F,,A,,C,]4 |[C,E,G,]4|[G,,B,,D,]4|[C,E,G,]4|
[V: RH1]
G2G2 |F2F2  | E2E2| D4 | G2G2| F2F2 | E2E2 | D4 | 
w: Up a- bove the sky so high, like a dia-mond in the sky.
[V: LH1]
[C,E,G,]4|[F,,A,,C,]4 | [C,E,G,]4 |[G,,B,,D,]4 | [C,E,G,]4| [F,,A,,C,]4 |[C,E,G,]4 | [G,,B,,D,]4 | 
[V: RH1]
C2C2 | G2G2|A2A2 | G4|F2F2 | E2E2|D2D2 | C4|
w: Twin kle, twin kle, litt le star, How I won der what you are
[V: LH1]
[C,E,G,]4 | [C,E,G,]4|[F,,A,,C,]4|[C,E,G,]4|[C,E,G,]4 | [C,E,G,]4|[F,,A,,C,]4 | [G,,B,,D,]4|

getlines4 - MeldoyPlusChord.htm

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...