Voice Synthesis Question

Harry E. Fassl hefassl at mcs.net
Sun Mar 4 19:27:06 UTC 2001


I've been experimenting with synthesizing speech from text contained in a 
file external to the image.

I've had to make two modifications to Speaker>>say.  (See below)

The first change is the modification of the literal1000 to 110.
If I leave the code at 1000, the delay between reading the line and the
beginning of 'speaking' is unacceptably long.
My guess is that this is/was processor speed dependent and maybe needs an
instance variable, with a default at init time and a setter. (I'm running a
B&W G3 @450MHz)

The second change is to have Speaker>>say return  events duration.  This is
used to pause the Speaker between lines. Otherwise the next line read starts
playing before the previous line finishes.
(See the workspace code below below)

Running Squeak 3.0 image Latest update #3545, VM30Alph7MT

Questions are
Am I going to step on something else by making these changes?
(Methodolgy suggestions for researching this graciously accepted.)

Is there a better way to get the result I'm after?

Harry
--
H.E.Fassl
http://www.mcs.net/~hefassl

say: aString
 | events stream string |
 events _ CompositeEvent new.
 stream _ ReadStream
    on: (aString findTokens: '?' keep: '?').
 [stream atEnd]
  whileFalse: [string _ stream next.
   stream atEnd
    ifFalse: [string _ string , stream next].
   events
    addAll: (self eventsFromString: string)].
 events playOn: self voice delayed: events duration * 110. "**Modified from
1000**"
 self voice flush.
 ^ events duration "**Returned for use with Delay to pause between lines.**"

WORKSPACE SNIPPET

|voiceFile  voiceText thisSpeaker thisVoice crcr timeDelay|
Transcript clear.
SoundPlayer stopReverb.
crcr _ String with: Character cr with: Character cr.
voiceFile _ StandardFileStream oldFileNamed: 'Nativity.text'.
thisVoice _KlattVoice new tract: 11.7;breathiness: 0.32;shimmer: 0.1;ro:
0.7;rk:0.45;ra: 0.008.
thisSpeaker _ Speaker new voice: thisVoice.
thisSpeaker pitch: 210.0; speed: 0.613.
[voiceFile atEnd] whileFalse:
[voiceText _ ((voiceFile upTo: Character cr) copyReplaceAll: crcr with: '')
withBlanksTrimmed.
Transcript show: voiceText;cr.
timeDelay _ Delay forSeconds: (thisSpeaker say: voiceText) + 1. "Pause
between lines to avoid next line starting before this one is finished."
timeDelay wait.
].
voiceFile finalize.






More information about the Squeak-dev mailing list