kripken / speak.js

Text-to-Speech in JavaScript using eSpeak
GNU General Public License v3.0
1.29k stars 295 forks source link

Changing pronunciation? #54

Open JamesSeddonClaro opened 8 years ago

JamesSeddonClaro commented 8 years ago

I'm building a speaking calculator, so I need to change how speak.js reads the numeric function characters (+, -, *, /) to plus, minus, times and divide.

*Plus already works

yukulele commented 7 years ago

you can replace it in text before read it:

var translation = {
  '+':'plus',
  '-': 'minus',
  '*': 'times',
  '/': 'divide'
}
var myTranslatedText = mytext.replace(/[-+/*]/g, (a) => ' ' + replacer[a] + ' ')
meSpeak.speak(myTranslated)