Skip navigation.
 
mlRe: NSSpeechSynthesizer and a speech dictionary
FROM : David Brennan
DATE : Fri Jun 27 22:29:50 2008

Hi,

I've been told that I can use sample dictionary in the documentation
for the UseSpeechDictionary function in the Speech Synthesis Manager
Reference, but I don't seem to be able to get it to work. Any ideas on
what I might be doing wrong would be a great help.

Below is the code that I am using to read the dictionary from a XML file

      speechSynth = [[NSSpeechSynthesizer alloc]
initWithVoice:@"com.apple.speech.synthesis.voice.Alex"];
      [speechSynth autorelease];

      NSDictionary *myDictionary = [NSDictionary
dictionaryWithContentsOfFile:@"/Users/david/Desktop/Test%20speech/SpeechDictionary/myDictionary"];
      [speechSynth addSpeechDictionary:myDictionary];

      [speechSynth startSpeakingString:@"Welcome to Ballina."];

The contains of the file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN"
"">
<plist version="1.0">
  <dict>
              <key>ModificationDate</key>
              <string>2006-12-21 11:59:25 -0800</string>
              <key>Pronunciations</key>
              <array>
                      <dict>
                              <key>Phonemes</key>
                              <string>AE_hEY_yUW</string>
                              <key>Spelling</key>
                              <string>Ballina</string>
                      </dict>
                      <dict>
                              <key>Phonemes</key>
                              <string>AE_hEY_yUW</string>
                              <key>Spelling</key>
                              <string>Hello</string>
                      </dict>
              </array>
              <key>Abbreviations</key>
              <array>
                      <dict>
                              <key>Phonemes</key>
                              <string>_OW_sAEkz</string>
                              <key>Spelling</key>
                              <string>OSAX</string>
                      </dict>
              </array>
  </dict>
</plist>

Regards,
Dave.

Related mailsAuthorDate
mlNSSpeechSynthesizer and a speech dictionary David Brennan Jun 26, 21:17
mlRe: NSSpeechSynthesizer and a speech dictionary David Brennan Jun 27, 22:29