Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an HTML Text Area that allows user input of coded notes; a note can be any single character you choose. A B C Write

Create an HTML Text Area that allows user input of coded "notes"; a "note" can be any single character you choose.

A
B
C
Write a script to read in the contents of the text area into string. Loop through each line of the string in such a way that each line may be accessed:

line.charAt(0); // A
next line
line.charAt(1); // B
next line
line.charAt(2); // C

Place each parsed "Note" into an array that would look like:

notes = ["A", "B", "C"]

Once the intermediate "notes" are compiled, loop through each note and play a sound associated with the "note."

new Audio('a.mp3').play()

You will need to figure out how to NOT have all the "Notes" play at the same time.. Ideas:

  • Use audioElement.addEventListener('ended', function() {}) and chain the notes together
  • Chain the "play" with setTimeout(function(){ }, 3000);

Use whatever mp3s you want, but "notes" on different lines should not play at the same time.

THEN...

In a second html text area, compile the notes into a stand alone HTML page using token substitution.





var htmlTEMPLATE = ""
htmlTEMPLATE = htmlTEMPLATE + "<\/head >"
htmlTEMPLATE = htmlTEMPLATE + "