Play random sound for user to identify & get feedback

Question

I’m trying to create an activity for English language students in which they improve their ability to distinguish similar sounds – e.g. word pairs like cash / catch

User clicks Play button and either of the words is played at random
User decides which word they heard and clicks on the button for cash or the button for catch
User gets feedback – either "Correct!" or "Incorrect, try again".

I’ve found the code to make my sound files play randomly, but now I need help with the rest. Please see what I have so far below:

function playSounds() {
var sounds = new Array(
“http://www.esltips.com.au/blog/wp-content/uploads/2020/12/catch.mp3”,
“http://www.esltips.com.au/blog/wp-content/uploads/2020/12/cash.mp3”
);
var index = Math.floor(Math.random() * (sounds.length));
$(“#element”).html(“”);
}

Listen

</div>

Any help would be much appreciated (but the way, I’m a teacher and not a web design guru). Maybe you could give me the code or maybe suggest a plugin that does this.

0
Pedro Picapiedra 1 month 0 Answers 8 views 0

Leave an answer