What i am trying to achieve here is the HTML Accessibility functionality. I want a single API like speechsynthesis which will work in all the browsers. Speechsynthesis doesn't work for Internet Explorer.
I don't think it can be done purely client side cross browser. However, there are JavaScript libraries that abstract both browser native functionality when it's available or call a web service api to get the audio otherwise.
https://responsivevoice.org/ is an example of this.