Skip to content

Commit 7893122

Browse files
committed
version 19.9b1
undo "now volume, rate and speed default parameters are send at start of speak method on ibmeci." Return to 19.b2. update now speech parameters on realtime are send via dll rater than annotations. fix NVDA 2019.2 doesn't change pitch when read upercase letters. fix sometimes voice parameters are sent delayed
1 parent 9e9eab4 commit 7893122

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

addon/synthDrivers/_ibmeci.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ def eciCheck():
177177
ttsPath = config.conf.profiles[0]['ibmeci']['TTSPath']
178178

179179
if not path.isabs(ttsPath):
180-
ttsPath = path.join(path.abspath(path.dirname(__file__)), ttsPath)
180+
ttsPath = path.abspath(path.join(path.abspath(path.dirname(__file__)), ttsPath))
181181
if path.exists(ttsPath): iniCheck()
182182
if not path.exists(ttsPath): return False
183183
if dll: return True
@@ -365,6 +365,9 @@ def setVParam(pr, vl):
365365
param_event.wait()
366366
param_event.clear()
367367

368+
def setProsodyParam(pr, vl):
369+
dll.eciSetVoiceParam(handle, 0, pr, vl)
370+
368371
def setVariant(v):
369372
user32.PostThreadMessageA(eciThreadId, WM_COPYVOICE, v, 0)
370373
param_event.wait()

addon/synthDrivers/ibmeci.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -46,14 +46,15 @@ def unicode(s):
4646
re.compile(r'(\w+)\.([a-zA-Z]+)'): r'\1 dot \2',
4747
re.compile(r'([a-zA-Z0-9_]+)@(\w+)'): r'\1 at \2',
4848
}
49+
4950
french_fixes = { re.compile(r'([a-zA-Z0-9_]+)@(\w+)'): r'\1 arobase \2' }
51+
5052
spanish_fixes = {
5153
#for emails
5254
re.compile(r'([a-zA-Z0-9_]+)@(\w+)'): r'\1 arroba \2',
5355
re.compile(u'([€$]\d{1,3})((\s\d{3})+\.\d{2})'): r'\1 \2',
5456
}
5557

56-
5758
variants = {
5859
1:"Reed",
5960
2:"Shelley",
@@ -132,20 +133,19 @@ def __init__(self):
132133
self.variant="1"
133134

134135
PROSODY_ATTRS = {
135-
speech.PitchCommand: b'vb',
136-
speech.VolumeCommand: b'vv',
137-
speech.RateCommand: b'vs',
136+
speech.PitchCommand: ECIVoiceParam.eciPitchBaseline,
137+
speech.VolumeCommand: ECIVoiceParam.eciVolume,
138+
speech.RateCommand: ECIVoiceParam.eciSpeed,
138139
}
139140

140141
def speak(self,speechSequence):
141142
last = None
142143
defaultLanguage=self.language
143144
outlist = []
144-
outlist.append((_ibmeci.speak, (b'`ts0 `pp0 `vb%d `vs%d `vv%d ' %(self.pitch, _ibmeci.getVParam(ECIVoiceParam.eciSpeed), self.volume),)))
145+
outlist.append((_ibmeci.speak, (b"`ts0",)))
145146
for item in speechSequence:
146147
if isinstance(item, string_types):
147148
s = self.processText(unicode(item))
148-
if not s: continue
149149
outlist.append((_ibmeci.speak, (s,)))
150150
last = s
151151
elif isinstance(item,speech.IndexCommand):
@@ -168,10 +168,10 @@ def speak(self,speechSequence):
168168
elif type(item) in self.PROSODY_ATTRS:
169169
val = max(0, min(item.newValue, 100))
170170
if type(item) == speech.RateCommand: val = self.percentToRate(val)
171-
outlist.append((_ibmeci.speak, (b' `%s%d ' %(self.PROSODY_ATTRS[type(item)], val),)))
171+
outlist.append((_ibmeci.setProsodyParam, (self.PROSODY_ATTRS[type(item)], val)))
172172
else:
173-
log.error("Unknown speech: %s" %item)
174-
if last and str(last[-1]) not in punctuation: outlist.append((_ibmeci.speak, (b'`p1. ',)))
173+
log.error("Unknown speech: %s"%item)
174+
if last is not None and not str(last[-1]) in punctuation: outlist.append((_ibmeci.speak, (b'`p1. ',)))
175175
outlist.append((_ibmeci.setEndStringMark, ()))
176176
outlist.append((_ibmeci.synth, ()))
177177
_ibmeci.eciQueue.put(outlist)
@@ -185,19 +185,20 @@ def processText(self,text):
185185
text = resub(french_fixes, text)
186186
text = text.replace('quil', 'qil') #Sometimes this string make everything buggy with IBMTTS in French
187187
if self._backquoteVoiceTags:
188-
text = text.replace('`', ' ') #no embedded commands
189-
text = text.encode('mbcs', 'replace')
190-
text = resub(anticrash_res, text)
191188
#this converts to ansi for anticrash. If this breaks with foreign langs, we can remove it.
189+
text = text.replace('`', ' ').encode('mbcs', 'replace') #no embedded commands
190+
text = b"`pp0 `vv%d %s" % (_ibmeci.getVParam(ECIVoiceParam.eciVolume), text)
191+
text = resub(anticrash_res, text)
192192
else:
193193
#this converts to ansi for anticrash. If this breaks with foreign langs, we can remove it.
194194
text = text.encode('mbcs', 'replace')
195-
text = text.replace(b'`', b' ') #no embedded commands
196195
text = resub(anticrash_res, text)
196+
text = b"`pp0 `vv%d %s" % (_ibmeci.getVParam(ECIVoiceParam.eciVolume), text.replace(b'`', b' ')) #no embedded commands
197197
text = pause_re.sub(br'\1 `p1\2\3', text)
198198
text = time_re.sub(br'\1:\2 \3', text)
199199
return text
200200

201+
201202
def pause(self,switch):
202203
_ibmeci.pause(switch)
203204

@@ -224,7 +225,6 @@ def _set_rateBoost(self, enable):
224225
self._rateBoost = enable
225226
self.rate = rate
226227

227-
228228
def _get_rate(self):
229229
val = _ibmeci.getVParam(ECIVoiceParam.eciSpeed)
230230
if self._rateBoost: val=int(round(val/self.RATE_BOOST_MULTIPLIER))

buildVars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
# Translators: Long description to be shown for this add-on on add-on information from add-ons manager
2020
"addon_description" : _("""This is the IBMTTS synthesizer driver for NVDA."""),
2121
# version
22-
"addon_version" : "19.8B4",
22+
"addon_version" : "19.9B1",
2323
# Author(s)
2424
"addon_author" : u"David CM <dhf360@gmail.com> and others",
2525
# URL for the add-on documentation support

0 commit comments

Comments
 (0)