Short: Speech Text Translator and Narrator Author: sisk637 cyberonic com (Robert A. Sisk) Uploader: sisk637 cyberonic com Type: util/misc Version: 1.12 Replaces: util/misc/SayToy.lha Requires: util/libs/mui38usr.lha util/rexx/rxmui.lha util/rexx/royalbridge11.lha util/misc/SofTalk.lha Architecture: generic SayToy translates text into phonemes and speaks them, animating a mouth and marking the words as they are spoken. Unlike similar programs it presents a modern, attractive graphic interface whose gadgets have understandable labels and descriptive bubble help. It supports live swapping of translators and narrators and saving and loading of multiple preferences files. SayToy is a MUI application written in ARexx, developed on an A4000/040 with AmigaOS 3.9 + BoingBags 1 & 2, MUI 3.8, RxMUI 42.2, RoyalBridge 1.1, and, from AmigaOS 2.04, Libs:translator.library and Devs:narrator.device. Suitable translator and narrator files are also available in the SofTalk archive. Another translator (with an upgrade patch) is util/libs/translator42.lha and util/libs/Tran43pch.lha. And there is a German translator, uebersetzer.library (util/cli/uebers10.lha). I use the Icon datatype class, util/dtype/IconDT44.lha, so several About windows look a bit prettier. Regarding the icon used in the About Narrator window, my system originally didn't provide it, so I copied :OS-Version3.9/icons/device.info from my AmigaOS 3.9 CD to Env(Arc):Sys/def_device.info. The links in the About requesters use OpenURL, comm/www/openurl.lha. To make the About SayToy address link work, in OpenURL preferences I edited my mailer command's address argument so the keyword is joined to its value by a space instead of an equals sign. The equals sign apparently exposes a bug in dos.library/Execute() that assumes an angle bracket indicates a stream redirection. SayToy is a demonstration of the power of ARexx and RoyalBridge to access arbitrary libraries and devices (in this case exec.library, translator.library, uebersetzer.library, and narrator.device). By releasing this script, I hope to encourage more development in ARexx. The AmigaOS 2.04 translator and narrator are documented in the Libraries and Devices manuals, respectively, on the AmigaOS 3.5 Developer CD V2.1. The SofTalk narrator enhances the Sex parameter by adding child settings, which SayToy supports. Other SofTalk extensions are not supported because I don't have developer documentation. Preferences The main window gadgets and the top two groups of Settings menu items are treated as preference settings by the third group of Settings menu items. The checkable Settings menu items are on by default. In the main window the sliders show their default values in their help bubbles, the cycle gadgets default to their top items, Repeat defaults to off, Animate to on, Text to a traditional announcement, and Phonemes to an empty string. The Save item writes to the last preferences file loaded or saved. If there is none, it writes to SayToy.prefs in the program's drawer or to the same file name in the Env:SayToy and EnvArc:SayToy drawers. When you save preferences, if Create Icons is checked and the icon file doesn't already exist, SayToy will copy the file Env:SayToy/def_prefs.info or Env:Sys/def_prefs.info or the system will provide a default project icon: Env:Sys/def_project.info or an internal image. The new icon will have a Cmd tool type containing a Settings argument which specifies the preferences file and also a copy of the program's Console tool type. However, if the program's absolute path contains a space, the tool types won't be written. You can also load a preferences file by dropping its icon on the main window, provided that the file has a .prefs extension. Preference gadgets, including the Translator and Narrator lists, have a pop-up menu with Reset to Default and Restore items. At quit time if the AutoSave menu item is checked, if any preference settings differ from when they were last loaded or saved - or, if no preference file was loaded or saved, from the default values - they are automatically saved as if the Settings > Save menu item were invoked. SayToy can mark each text and/or phoneme word as it is spoken. Say Phonemes doesn't mark the text because the text isn't processed in this action. You can set the marked colors in MUI preferences for the Textinput class. Translator and Narrator Preferences The translator setting defaults to an unspecified version of translator.library or uebersetzer.library in that order of priority. Narrator defaults to an unspecified version of narrator.device. During testing of SayToy I often swapped versions of the translator and/or narrator by quitting the programs that used the library/device so that it wasn't open, flushing it from memory, renaming it so it wouldn't be recognized, replacing it with the desired file, and restarting the program. The translator and narrator preference features automatically close, flush, rename, and reopen. Of course, SayToy won't quit other applications for you. SayToy will recognize translators and narrators in the first assigned targets of Libs: and Devs:, respectively, if additional files are renamed only by adding something to the end - for example, "translator.libraryX". You can make the individual files more identifiable in the About and Settings windows by giving them comments like "original" and "SofTalk". Setting a specific translator or narrator sets its version - for example, 33.1 - and for translator also its name. Setting the default value - choosing the Reset to Default item from the Translator or Narrator listview's pop-up menu or the Reset to Defaults item from the Settings window menu, choosing Restore from a pop-up or the window menu when the initial value is the default, or starting SayToy with the default value (see Settings option below) - sets an unspecified value and will not cause any swapping to be performed. If loading a preferences file complains about not finding a specific version - because since you saved the preferences you've removed that version - or about not being able to flush the object from memory - because it's in use by another application - the setting will assume its default value. (You can verify this by noting that the list pop-up menu's Reset to Default item is disabled.) If you resave preferences at that point to include the default value, you can avoid the complaint about not finding the version the next time you load that preferences file. Startup Options If SayToy receives options from the command line or from the Cmd tool type, it processes them with the following argument template. Otherwise, it reads its options as tool types with the same keywords. AudioFilterOff/S,Settings/K,MonitorPrefs/S,PubScreen/K · AudioFilterOff disables the Amiga's high-frequency audio filter, improving the sound of speech. Caution: This option is intended for classic Amigas with the software- controllable audio filter. If you are running this program on other hardware, don't use this option; it may be unfriendly to your system. As far as I can tell, there's no way for a program to verify the presence of the filter before accessing it. · Settings specifies a preferences file saved in a previous execution to preload. Default: SayToy.prefs in the program's home drawer or the same file name in the Env:SayToy drawer. · MonitorPrefs writes console messages showing the Settings option and the names of any preferences files accessed. · PubScreen names a public screen to open on, overriding the corresponding setting in MUI preferences. Known Problems The SofTalk narrator seems less compatible with the original OS version than it claims. For example, it doesn't report mouth shapes, requesting both audio channels uses only the right one, and child settings speak faster than the adult ones. Activating a string gadget by clicking on it with the mouse removes the pop-up menu. I've reported the problem to RxMUI's author. You can work around the problem by activating the string only from the keyboard. When the text or phoneme string gadget is marked, it shows a cursor, even when the string is not active. This is apparently a glitch in Textinput.mcc class. Marking words appears to be slow and asynchronous; it can lag behind the speech, especially at high speaking rates. Also, the translator can generate a phoneme string with a different word count from the text, causing phoneme word marking to lose synchronization with that of the text and with the speech itself. History 1.12 Fixed bugs: Text and phonemes strings disallow control characters. Fixed bug: Mishandled 32-bit memory address values. 1.11 Fixed bug: Creating preferences icon with Cmd tool type mishandled " and * characters in Settings argument. 1.10 Fixed bugs: Used longer than recommended text and phoneme buffers with uebersetzer.library. (Thanks to Thore Sittly for English translation of Uebersetzer.doc) 1.9 Fixed bug: If you changed the accent settings in the Translator preferences editor while SayToy was running, the new values didn't take effect until the next time the library was opened, which might have been after setting the translator or starting SayToy again. SayToy now recognizes the new accent settings immediately. Of course, the accent settings apply only to translator V42+. 1.8 Added word marking feature. Fixed bug: When Settings > Save failed, failed to save to backup preferences files in Env: and EnvArc:. 1.7 Reworked GUI: uses full sliders instead of numeric buttons, moves numeric ranges to help bubbles, other small changes. Fixed bug: When saying text, loading phonemes wasn't reflected in disabling of pop-up and window menus. 1.6 Added translator and narrator preferences for live swapping among multiple versions. Removed Uebersetzer startup option. Support now included in translator preference. Added AutoSave feature. Reset to Default(s) and Restore items in preference gadget pop-up menus and in Settings window menu and Settings > Save item are now disabled when they have nothing to do. 1.5 About ARexx window listview now scrolls from keyboard without needing to be activated first (like About MUI listview). 1.4 About ARexx window library list now shows version and date. About Narrator window now uses the default device icon. Removed About RoyalBridge window. Its version is now included in About ARexx window. 1.3 Added support for uebersetzer.library. (Uebersetzer has only German documentation, which doesn't help me a bit. :-/ Support for it assumes full compatibility.) Added About windows for Narrator, Translator, and RoyalBridge. Expanded documentation. 1.2 Sets current directory to home drawer earlier so opening libraries always searches there. Ctrl C and halt interrupts no longer write console message before exiting. Added caution about AudioFilterOff option. Now ships with this tool type disabled. 1.1 Added feature: Pressing the Return key in either the Text or Phonetic string gadget now automatically says the text. (Requested by James Jacobs) Fixed bug: called graphics.library/DrawEllipse() with illegal zero radius. (Reported by James Jacobs) 1.0 First Aminet release. I welcome your comments and questions.