← develop-27 9609 September 1996

develop-27 9609 September 1996

From the originals

13 scans

Machine-transcribed text and image descriptions. Check the linked original for uncertain words or fine print.

These are transcribed pages from the documents, not the full publications. Open the original for the remaining pages.

Image 1

LaserWriter Driver Version 8.4 • Part Editor Unloading • Traversing GX Paths develop Issue 27 September 1996 The Speech Recognition Manager Adding Speech Recognition to an Application Framework Working With OpenDoc Part Kinds Using Apple Guide 2.1 With OpenDoc Mac OS 8 Assistants in System 7 Applications Game Controls for QuickDraw 3D $10.00

A colorful cover with a blue top banner, a handwritten-style 'develop' logo with an Apple logo, a left column of orange and black cover story headlines, and a right grid of abstract illustrations including sound waveforms, a stylized human profile, and wavy lines.

Reading notes: Logo script 'develop' is stylized and read as a word; the illustration overlays contain faint, partly illegible background lettering that was not transcribed. Reading order of the left column headlines is top to bottom as printed.

Printed product names
develop
Printed prices
$10.00
Printed dates
September 1996
Languages
English
PDF page 1

The Speech Recognition Manager Adding Speech Recognition to an Application Framework Working With OpenDoc Part Kinds Using Apple Guide 2.1 With OpenDoc Mac OS 8 Assistants in System 7 Applications Game Controls for QuickDraw 3D $10.00 LaserWriter Driver Version 8.4 • Part Editor Unloading • Traversing GX Paths Issue 27 September 1996

Reading notes: No single headline is identifiable; the supplied copy is a list of cover lines, so headline is null. The listed titles (for example Mac OS 8, QuickDraw 3D, LaserWriter Driver Version 8.4) appear to be article topics rather than advertised products, so productNames is empty. No image was provided, so the visual description and reading order are inferred only from the supplied text and may not match the layout. Issue 27 is a volume-style issue number rather than a date and was not listed in printedDates.

Printed prices
$10.00
Printed dates
September 1996 · 1996
Languages
English
PDF page 2

E D I T O R I A L S T A F F Editor-in-Cheek Caroline Rose Editor-in-Cheek’s Clothing (during Caroline’s sabbatical) Lorraine Anderson Managing Editor Toni Moccia Technical Buckstopper Dave Johnson Bookmark CD Leader Alex Dosher Able Assistants Meredith Best, Beth Runciman Bosses Mark Bloomquist , Garry Hornbuckle, Steve Strong Review Board Brian Bechtel, Dave Radcliffe, Quinn “The Eskimo!”, Jim Reekes, Bryan K. “Beaker” Ressler, Larry Rosenstein, Nick Thompson, Gregg Williams Contributing Editors Lorraine Anderson, Linda Fogel, Toni Haskell, Tim Monroe, Cheryl Potter, Erik Sea, George Truett Indexer Marc Savage A R T & P R O D U C T I O N Art Direction Lisa Ferdinandsen Technical Illustration John Ryan Formatting Forbes Mill Press Production Diane Wilcox Photography Sharon Beals, Lisa Ferdinandsen Cover Illustration Graham Metcalfe of Metcalfe/Shuhert Design ISSN #1047-0735. © 1996 Apple Computer, Inc. All rights reserved. Apple, the Apple logo, AppleScript, AppleTalk, Bento, ColorSync, HyperCard, LaserWriter, MacApp, Macintosh, MacTCP, MessagePad, MPW, Newton, OpenDoc, PlainTalk, PowerBook, Power Macintosh, PowerTalk, QuickTime, and TrueType are trademarks of Apple Computer, Inc., registered in the U.S. and other countries. AOCE, A/ROSE, Balloon Help, Cyberdog, develop, Dylan, Finder, Mac, MacinTalk, NewtonScript, and QuickDraw are trademarks of Apple Computer, Inc. PostScript is a trademark of Adobe Systems Incorporated or its subsidiaries and may be registered in certain jurisdictions. PowerPC, SOM, and SOMobjects are trademarks of International Business Machines Corporation, used under license therefrom. All other trademarks are the property of their respective owners. T H I N G S T O K N O W develop, The Apple Technical Journal, a quarterly publication of Apple Computer’s Developer Relations group, is published in March, June, September, and December. It provides developers of Apple-platform products with technical articles and code that have been reviewed for robustness by Apple engineers. Electronic develop. This issue and all back issues of develop, along with the code they describe, can be found on the develop Bookmark CD or the Reference Library edition of the Developer CD Series (see below), or at http://dev.info.apple.com/develop/ or ftp://ftpdev.info.apple.com/ Developer_Services/Periodicals/ develop/. The code is updated regularly, so always use the latest version. This issue’s CD. Subscription issues of develop are accompanied by the develop Bookmark CD. This CD contains a subset of the materials on the Developer CD Series , which is part of the Apple Developer Mailing available through the Apple Developer Catalog . The CD also contains Technotes, sample code, and other documentation and tools (these contents are subject to change). Items referred to as being on “this issue’s CD” are located on either the Bookmark CD or the Reference Library or Tool Chest edition of the Developer CD Series . The Bookmark CD contents can also be accessed from http://dev.info.apple.com/ or from ftp://ftpdev.info.apple.com/ Developer_Services/. Macintosh Technical Notes. A designation like “(CS 06)” after a reference to a Macintosh Technical Note or Macintosh Technical Q&A indicates its category and number. (CS is the ColorSync category.) The new (uncategorized) Technotes are designated by number alone. C O N T A C T I N G U S Feedback. Send editorial comments or suggestions to Caroline Rose at crose@apple.com. Technical questions about develop should be directed to Dave Johnson at dkj@apple.com or CompuServe 75300,715. You can also send a fax to Caroline or Dave at (408)974-9423, or write to them at Apple Computer, Inc, 1 Infinite Loop, Cupertino, CA 95014. Article submissions. Ask for our Author’s Guidelines and a submission form at develop@apple.com. Subscriptions and back issues. You can subscribe to develop through the Apple Developer Catalog (see ordering information below, or use the subscription card in this issue). Back issues, in addition to being available electronically, can also be ordered through the catalog. The one-year U.S. subscription price is $30 (for four issues and four develop Bookmark CDs), or U.S. $50 in other countries. Back issues are $13 each. These prices include shipping and handling. For Canadian orders, the subscription price includes GST (R100236199). Apple Developer Catalog. To order develop or other products through the catalog or to make subscription- related queries, call 1-800-282-2732 in the U.S., 1-800-637-0029 in Canada, (716)871-6555 internationally, or (716)871-6511 for fax. You can send e-mail to order.adc@applelink.apple.com, use the catalog on the Web at http:// www.devcatalog.apple.com, or write Apple Developer Catalog , Apple Computer, Inc., P.O. Box 319, Buffalo, NY 14207-0319. For all subscription changes or queries, please be sure to include your name, address, and account number as they appear on your mailing label. Printed on recycled paper by Stream International, USA

Reading notes: Supplied copy contains a headline-like masthead line 'E D I T O R I A L S T A F F' but its visual placement could not be verified. Prices and dates in the supplied copy (for example $30, $50, $13, 1996) could not be confirmed as visibly printed advertisement copy because no image was provided, so they are left out of the printed fields. Product names in the supplied copy could not be confirmed as advertised products from the visible page, so productNames is left empty.

PDF page 3

A R T I C L E S 6 The Speech Recognition Manager Revealed by Matt Pallakoff and Arlo Reeves 22 Adding Speech Recognition to an Application Framework by Tim Monroe With these two articles, you’ll have your application recognizing speech in no time. The first is an introduction to the long-awaited API for speech recognition, and the second is an example of adding basic speech recognition capabilities to a PowerPlant application. Listen up! 37 Working With OpenDoc Part Kinds by Tantek Çelik and Dave Curbow Part kinds are like file types, only more so, and the choices you make about which part kinds to support will have a profound effect on users’ experiences with your part editor. 53 Using Apple Guide 2.1 With OpenDoc by Peter Commons Apple Guide 2.1 has been extended to work well in OpenDoc’s brave new world of compound documents and processes within processes. Here’s a look at the new features and how to take advantage of them. 72 Mac OS 8 Assistants in System 7 Applications by José Arcellana and Arno Gourdol Assistants will provide interview-based help in Mac OS 8, guiding users through complex tasks. This article gives some tips on designing an assistant and shows how you can implement one now, under System 7. 87 Game Controls for QuickDraw 3D by Philip McBride First-person 3D applications, whether games or 3D modeling systems, need to constantly move the camera to reflect the changing point of view of the player. You too can inflict vertigo on your users. C O L U M N S 34 PRINT HINTS The All-New LaserWriter Driver Version 8.4 by Dave Polaschek The new version of the LaserWriter driver is way different. Will your application break? 69 THE OPENDOC ROAD Facilitating Part Editor Unloading by Vincent Lo Part editors are unloaded automatically when they’re not needed, but your editor can help. 82 BALANCE OF POWER Stalking the Wild Defect by Dave Evans A tour through the dangerously twisted jungle of the Power Macintosh. Please keep your head and arms inside at all times. 98 GRAPHICAL TRUFFLES A Library for Traversing Paths by Daniel I. Lipton Parsing QuickDraw GX geometric shapes takes a bit of code, but it’s already been written for you. 102 MACINTOSH Q & A Answers from Apple’s Developer Support Center — lots on Open Transport this time. 111 THE VETERAN NEOPHYTE Your Friend the Drill Sergeant by Dave Johnson Learning to shoot pool isn’t anything like learning to program computers. Right? 113 NEWTON Q & A: ASK THE LLAMA Answers to Newton-related development queries. 118 KON & BAL’S PUZZLE PAGE QuickTime Quandary by Konstantin Othmer and Bruce Leak More Macintosh madness from the MacsBug mentors. There’s a possibility you might actually score on this one! 2 EDITOR’S NOTE 3 LETTERS 123 INDEX Issue 27 September 1996 CONTENTS 1

Reading notes: Table of contents page numbers and column layout may affect reading order

Printed product names
Mac OS 8 · System 7 · QuickDraw 3D · OpenDoc · Apple Guide 2.1 · PowerPlant · QuickDraw GX · Open Transport · LaserWriter · Newton · QuickTime · MacsBug · Power Macintosh
Printed dates
September 1996 · Issue 27
Languages
English
PDF page 4

EDITOR'S NOTE

As I write this our esteemed Editor-in-Cheek is off on sabbatical, indulging in a little global gallivanting and some well deserved (and completely unstructured) hanging around. Thus it falls to me to write this editorial, making this only the second issue of develop that has had two pictures of me in it (trivia question: which was the other?), and also marking the first time (and hopefully the last time) my signature has been aired in public. (Yes, I know it’s illegible, and I confess: I never really learned to write cursive. So it’s only a rough approximation. Even my printing is barely legible. Thank goodness for keyboards.) Unaccustomed as I am to editorial speaking, I was having a hard time thinking of something to write about. Fortuitously, Apple’s Worldwide Developers Conference occurred just about the time I needed to settle on a topic, and as always the developers I talked with at the conference brought up several issues about what we on the develop staff do and why we do it that way. One issue that came up is conveniently editorial in nature. We’re often applauded for the better-than-usual (at least for a technical journal) writing in our articles and columns. It’s quite true that in addition to trying to make sure everything in the magazine is correct, we also put a lot of effort into making it read well. This is great for you, the reader, but as with any way of doing things there’s a downside. In this case, it means more trouble and more work for those who generate the content of the journal. Occasionally an author thinks it’s a hassle, all that fussing over finding the right word or phrase, all that questioning and worrying over something that’s “off the topic” as far as they’re concerned. For others, of course, it’s a real blessing, having our highly trained team of crackerjack editors swarming over their work, nipping and tucking and polishing it until it’s snug and smooth and gleaming. While I naturally tend to side with the latter, everybody’s entitled to an opinion. Those of us here at develop believe that it’s absolutely worth it. It’s a truism about technical writing that if it’s done well no one notices it. That’s our goal, and always has been, and I think it’s a good and important one. If you have to read a sentence twice or three times to figure out what it means, or if you have to backtrack a page to make sense of something you just read, or if you can’t find a constant in Inside Macintosh because it’s spelled wrong in the article, then the writing will be noticed, because it’s getting in your way. That’s something we’re proud to avoid more often than not, even though it takes longer, and even though it’s a lot more work. We hope you agree. So that’s my editorial. An easy out, some might say, simply restating our editorial philosophy rather than coming up with new thoughts. But it’s something that’s often lost in all the noise, and I think it’s good — both for us and for you — to be reminded once in a while why it is we do what we do. DAVE JOHNSON FOR CAROLINE ROSE develop Issue 27 September 1996 2 EDITOR’S NOTE DAVE JOHNSON (dkj@apple.com) and his wife Lisa have a tiny but thriving mask-making business in San Francisco, selling masks for a one-month period each year around Halloween. In 1994 they had sales of $344 and gross profits were $159. (There was a write-down of $188 that year for retooling, resulting in a net loss of $29.) In 1995 they had total profits of $287 on sales of $330. If this explosive profit growth keeps up, this small garage business could, in time, be worth literally hundreds of millions of dollars. Dave is rubbing his hands in anticipation.• Dave Johnson Editorial Pretender

Reading notes: Reading order of the editorial and the EDITOR'S NOTE sidebar is not clearly separated in the supplied text. The primary heading is ambiguous: the editorial has no explicit title beyond its byline.

Printed product names
Inside Macintosh
Printed prices
$344 · $159 · $188 · $29 · $287 · $330
Printed dates
1994 · 1995 · September 1996 · Issue 27
Languages
English
PDF page 5

NURB CURVES TYPO I’m an M.S. student in the Department of Industrial Engineering at Bogazici University, Istanbul, Turkey. My thesis is about pattern recognition using implicit polynomials in CAD applications. While I was surfing the Internet, I found the article “NURB Curves: A Guide for the Uninitiated” in develop Issue 25 and read it. It’s a very good resource for those (like me) with minimal knowledge of NURB curves and representations, and I liked it a lot. But in Figure 20 there’s a mistake, I think. Control point B2 has coordinates {2, 0, 0}, but I believe the last index ( w ) should be 1. Is that right? — Ugur Murat Erdem Yes, in fact you’ve found a typographical error in the figure you mention: B2 should be {2, 0, 1}. We had a very good editor and several reviewers, but none of them caught this. I hope it doesn’t mislead anyone too much. Thanks for pointing it out. — Philip Schneider TECHNICAL Q&A: WHERE? In the Issue 25 Macintosh Q&A, you explain a new method for embedding GX pictures into QuickDraw PICT files. It says that we can find sample code in the Macintosh Technical Q&A “Embedding a GX Picture into a PICT” (GX 07). Unfortunately, I haven’t found this file on any developer CD I have. Could you please help me locate this information? — Michel Renon That Q&A can be found on the Web at http://dev.info.apple.com/techqa/qdgx/ gx07.html. In general, the Web site http:// dev.info.apple.com/techqa/Main.html has the latest and greatest Macintosh Technical Q&As. They sometimes take a while to find their way to the CDs, and that was the case here. That Q&A is now available on the CDs as well. Sorry for any inconvenience. — Dave Johnson TIME-SAVING TIPS I really enjoyed Bo3b Johnson’s Veteran Neophyte column in Issue 25 about ways to avoid wasting time. After programming the Mac for 10 years, I’m finally learning many of the things he talked about. It’s funny looking back at all the mistakes I’ve made while thinking I was so smart. I worked at Berkeley Systems on After Dark. One of the first things I did was write the Warp (or starfield) screen saver. I came up with a really cool assembly routine that, given an x and y , would draw the pixel on any monitor at any bit depth. It was a complicated routine (remember, I’m very smart) that used lots of shifts, multiplies, and divides. Even though I commented it, I still had to sit down and work through it each time I needed to make a change. Finally a coworker asked why I didn’t just write a separate routine for each bit depth. I scoffed and said my routine was really cool. Needless to say, I rewrote it into separate routines; it was really easy, and is easy to maintain and change as well. These days, instead of banging my head trying to come up with a “smart” way to do things, I just code in the most straightforward way I know how. I’m finding that I have better things to do than screw around with a triply linked list that looked good in Dr. Dobbs but LETTERS LETTERS 3 TELL US WHAT YOU THINK (PLEASE) We welcome your letters to the editor, especially regarding articles published in develop. Write to Caroline Rose at crose@apple.com or, if technical develop-related questions, to Dave Johnson at dkj@apple.com. All letters should include your name and company name as well as your address and phone number. Letters may be excerpted or edited for clarity (or to make them say what we wish they did). Address subscription-related queries to order.adc@applelink.apple.com.•

Reading notes: Letters section contains multiple reader letters, reading order across columns is uncertain Some hyphenated line breaks and special characters such as the 'x' and 'y' placeholders are ambiguous Figure reference and some OCR-like spacing in the source text may affect accuracy

Printed product names
GX · QuickDraw PICT · Macintosh · develop · After Dark · Dr. Dobbs
Printed dates
10 years
Languages
English
PDF page 6

isn’t really appropriate for my problem. I hate reliance on C-isms that aren’t obvious: if you have to pull out the ANSI C book to figure it out, it isn’t good code. By the way, another good book is The Psychology of Computer Programming by Gerald M. Weinberg. It was written in 1971 but has some very interesting views on programming and programmers. — Bruce Burkhalter I’m not a windsurfer, but I am a Mac developer, so I read Bo3b Johnson’s column in Issue 25 with great interest. My boss (Markus Fest, the programmer of Toast CD-ROM Pro) told me it was a Pflichtlektüre (something you just gotta read). He was right. There’s a book that should have been in your Recommended Reading section: Code Complete by Steve McConnell (Microsoft Press, 1993). It’s worth checking out. Enjoy! — Florian Dejako It’s amusing to look back and see how we learned the things we did, and how they’ve helped or hindered us. That introspection is actually what spawned the column: I realized that maybe others could avoid those mistakes if they read about them in advance. To this day I run into arguments about using the full “power” of C/C++. I hate to see people writing code just to use some feature of C++ like operator overloading. If they can redirect that creative energy to figuring out a better algorithm, it’s a total win. I think restrictions can actually be liberating, by freeing you from having to think about everything. If the brace style in code were enforced, how many hours of wasted brain time would we get back? Having the meaningless stuff like brace style fixed in stone makes it easier to apply cleverness to the things that matter, like the quality of the software. And Florian: thanks. I’ve never been called a Pflichtlektüre before, but I kinda like it. — Bo3b Johnson develop Issue 27 September 1996 4 DEVELOPER UNIVERSITY D U Learn how software components allow you to simplify the way you develop software. Take Developer University’s Creating OpenDoc Parts class and learn how to create parts using the OpenDoc Framework. 5 days, $1500 September 16 - 20 October 28 - November 1 December 9 - 13 For more information, please visit Developer University's Web site at http://dev.info.apple.com/du.html or call our registrar at 408-974-4987. All courses offered in Cupertino, CA.

Reading notes: German term 'Pflichtlektüre' with parenthetical gloss appears within English reader letters Course schedule dates appear without year and are listed as printed

Printed product names
OpenDoc · OpenDoc Framework · Toast CD-ROM Pro · Creating OpenDoc Parts
Printed prices
$1500
Printed dates
1996 · 1971 · 1993 · September 16 - 20 · October 28 - November 1 · December 9 - 13
Languages
English · German
PDF page 7

Issue 1 Color; Palette Manager; Offscreen Worlds; PostScript; System 7; Debugging Declaration ROMs Issue 2 C++ (Objects; Style Guide); Object Pascal; Memory Manager; MacApp; Object-Based Design Issue 3 ISO 9660 and High Sierra; Accessing CD Audio Tracks; Comm T oolbox; 8•24 GC Card; PrGeneral Issue 4 Device Driver in C++; Polymorphism in C++; A/ROSE; PostScript; Apple IIGS Printer Driver Issue 5 (Volume 2, Issue 1) Asynchronous Background Networking; Palette Manager; Macintosh Common Lisp Issue 6 Threads; CopyBits; MacTCP Cookbook Issue 7 QuickTime 1.0; TrueType; Threads and Futures; C++ Objects in a World of Exceptions Issue 8 Curves in QuickDraw; Date and Time Entry in MacApp; Debugging; Hybrid Applications for A/UX Issue 9 Color on 1-Bit Devices; TextBox You’ve Always Wanted; Sound; T erminal Manager; Debugging Drivers Issue 10 Apple Event Objects; Enhancements for the LaserWriter Font Utility; GWorlds; The Optimal Palette Issue 11 Asynchronous Sound; Multibuffering Sounds; Exceptions; NetWork: Distributed Computing Issue 12 Components; Time Bases; Apple Event Coding Through Objects; Globals in Standalone Code Issue 13 Asynchronous Routines; QuickTime and Components; Debugging; Color Printing; DeviceLoop Issue 14 Localizable Applications; 3-D Rotation; QuickTime (Video Digitizing; Making Better Movies) Issue 15 QuickDraw GX; Component Registration; Floating Windows; Working in the Third Dimension Issue 16 Making the Leap to PowerPC; PowerTalk; Drag and Drop From the Finder; Color Matching With QuickDraw GX; International Number Formatting Issue 17 Newton Proto T emplates; PowerPC (Standalone Code; Debugging); Thread Manager; Window Zooming Issue 18 Apple Guide; Open Scripting Architecture; Graphics Speed on the Power Macintosh; Displaying Hierarchical Lists; Preferences Files Issue 19 OpenDoc Part Handlers; PowerPC Memory Usage; Designing for the Power Macintosh; QuickDraw GX (Printing; Bitmaps); Inheritance in Scripts Issue 20 AOCE; Make Your Own Sound Components; Scripting the Finder; NetWare on PowerPC Issue 21 OpenDoc Graphics; Designing a Scripting Implementation; Dylan; Object-Oriented Hierarchical Lists Issue 22 QuickDraw 3D; Copland; PCI Device Drivers; Custom Color Search Procedures; The OpenDoc User Experience; Futures Issue 23 QuickTime Music Architecture; QuickDraw 3D Geometries; Internet Config; Multipane Dialogs; Document Synchronization; ColorSync 2.0 Issue 24 Speeding Up whose Clause Resolution; OpenDoc Storage; Sound; Alert Guidelines; Printing Faster With Data Compression; The New Device Drivers Issue 25 QuickTime VR Movies From QuickDraw 3D; Flicker-Free Drawing With QuickDraw GX; NURB Curves; C++ Exceptions in C; Localized Strings for Newton Issue 26 Mac OS 8 Compatibility; QuickTime Conferencing; OpenDoc Parts and SOM Dynamic Inheritance; Adding Custom Data to QuickDraw 3D Objects; 64-Bit Integer Math on 680x0 Machines develop VR m ral d with 3D dat QuickTim movies from their da to show potential cu the movies display th objects more effective representation and co the data in the process Archaeologists can Q VR movies to record si during digs, realtors can Looking to complete the set? If you’re looking for a complete develop collection, full-color, bound copies are available for $13 per issue, including shipping and handling. (Back issues are also on the develop Bookmark CD and the Developer CD Series Reference Library edition, as well as on the Internet.) For more information about how to order printed back issues (and where to find them online), see the inside front cover of this issue. Supplies are limited. Please allow 4 to 6 weeks for delivery.

Reading notes: Headline not clearly identifiable as a single primary heading; source contains issue index listing rather than a headline Fragmented text in the QuickTime VR promotional passage may affect reading order

Printed product names
develop · develop Bookmark CD · Developer CD Series Reference Library
Printed prices
$13
Languages
English
PDF page 8

As any Star Trek fan knows, the computer of the future will talk and listen. Macintosh computers have already been talking for a decade, using speech synthesis technologies such as MacinTalk or the Speech Synthesis Manager. Now any Power Macintosh application can use Apple’s new Speech Recognition Manager to recognize and respond to spoken commands as well. We’ll show you how easy it is to add speech recognition to your application. Speech recognition technology has improved significantly in the last few years. It may still be a long while before you’ll be able to carry on arbitrary conversations with your computer. But if you understand the capabilities and limitations of the new Speech Recognition Manager, you’ll find it easy to create speech recognition applications that are fast, accurate, and robust. With code samples from a simple speech recognition application, SRSample, this article shows you how to quickly get started using the Speech Recognition Manager. You’ll also get some tips on how to make your application’s use of speech recognition compelling, intuitive, and reliable. For everything you need in order to use the Speech Recognition Manager in your application (including SRSample and detailed documentation), see this issue’s CD or Apple’s speech technology Web site at http://www.speech.apple.com. WHAT THE SPEECH RECOGNITION MANAGER CAN AND CANNOT DO The Speech Recognition Manager consists of an API and a recognition engine. Under System 7.5, these are packaged together in version 1.5 or later of the Speech Recognition extension. (This packaging may change in future OS versions.) The Speech Recognition Manager runs only on Power Macintosh computers with 16-bit sound input. Speech recognition is simply too computation-intensive to run MATT PALLAKOFF AND ARLO REEVES The Speech Recognition Manager Revealed develop Issue 27 September 1996 6 MATT PALLAKOFF (mattp@apple.com), Apple’s Speech Recognition engineering manager, likes to talk to inanimate objects. He has spent the last several years helping Apple’s speech group pull speech recognition technology kicking and screaming over a threshold of usability that (as of PlainTalk 1.4) finally allows Power Macintosh users to leave speech recognition on and use it in simple ways every day. He denies ever having worked in the field of Artificial Intelligence.• ARLO REEVES (arlo@apple.com) has had a varied employment history that includes baby- sitting young Peregrine falcons in Yosemite, studying variable stars from Nantucket, and adding two-dimensional FFT capabilities to NIH Image. Lately he’s been helping Matt and the speech team at Apple bring the Speech Recognition Manager into existence. Arlo lives in Santa Cruz, California, where he enjoys spending his free time out of doors with his friends.•

Reading notes: Byline and sidebar text ordering may be ambiguous in the extracted copy

Printed product names
Macintosh · MacinTalk · Speech Synthesis Manager · Power Macintosh · Speech Recognition Manager · SRSample · System 7.5 · Speech Recognition extension · PlainTalk 1.4 · NIH Image
Printed dates
September 1996 · Issue 27
Languages
English
PDF page 9

well on most 680x0 systems. The installed base of Power Macs is growing by about five million a year, however, so plenty of machines — including the latest PowerPC™ processor–based PowerBooks — can run speech recognition. The current version of the Speech Recognition Manager has the following capabilities and limitations: • It’s speaker independent, meaning that users don’t need to train it before they can use it. • It recognizes continuous speech, so users can speak naturally , without — pausing — between — words. • It’s designed for North American adult speakers of English. It’s not localized yet, and in general it won’t work as well for children. • It supports command-and-control recognition, not dictation. It works well when your application asks it to listen for at most a few dozen phrases at a time; however, it can’t recognize arbitrary sentences and its accuracy decreases substantially if the number of utterances it’s asked to listen for grows too large. For example, it won’t accurately recognize one name out of a list of five thousand names. OVERVIEW OF THE SPEECH RECOGNITION MANAGER API To use the Speech Recognition Manager, you must first open a recognition system , which loads and initializes the recognition toolbox. You then allocate a recognizer, which listens to a speech source for sound input. A recognizer might also display a feedback window that shows the user when to speak and what the recognizer thinks was said. To define the spoken utterances that the recognizer should listen for, you build a language model and pass it to the recognizer. A language model is a flexible network of words and phrases that defines a large number of possible utterances in a compact and efficient way. The Speech Recognition Manager lets your application rapidly change the active language model, so that at different times your application can listen for different things. After the recognizer is told to start listening, it sends your application a recognition result whenever it hears the user speak an utterance contained in the current language model. A recognition result contains the part of the language model that was recognized and is typically sent to your application via Apple events. (Alternatively, you can request notification using callbacks if you cannot support Apple events.) Your application then processes the recognition result to examine what the user said and responds appropriately. Figure 1 shows how the Speech Recognition Manager works. Note that the telephone speech source is not supported in version 1.5 of the Speech Recognition extension. SPEECH OBJECTS The recognition system, recognizer, speech source, language models, and recognition results are all objects belonging to classes derived from the SRSpeechObject class, in accordance with object-oriented design principles. These and other objects are arranged into the class hierarchy shown in Figure 2. The class hierarchy gives the Speech Recognition Manager API the flexibility of polymorphism. For example, you can call the routine SRReleaseObject to dispose of any SRSpeechObject. THE SPEECH RECOGNITION MANAGER REVEALED 7

Reading notes: Bullet-list and line-break layout in the source text may affect reading order Hyphenated line-break 'speech-recognition' may be ambiguous

Printed product names
PowerPC™ processor–based PowerBooks · Power Macs · Speech Recognition Manager · SRSpeechObject · SRReleaseObject
Languages
English
PDF page 10

The most important speech objects are as follows: • SRRecognitionSystem — An application typically opens one of these at startup (by calling SROpenRecognitionSystem) and closes it at shutdown (by calling SRCloseRecognitionSystem). Applications allocate other kinds of objects by calling routines like SRNewWord, which typically take the SRRecognitionSystem object as their first argument. • SRRecognizer — An application gets an SRRecognizer from an SRRecognitionSystem by calling SRNewRecognizer. The SRRecognizer does the work of recognizing utterances and sending recognition results back to the application. It begins doing this whenever the application calls SRStartListening and stops whenever the application calls SRStopListening. • SRLanguageModel, SRPath, SRPhrase, SRWord — An application builds its language models from these object types, which are all subclasses of SRLanguageObject. (A phrase is a sequence of one or more words, and a path is a sequence of words, phrases, and language models.) A language model, in turn, describes what a user can say at any given moment. For example, if an application displayed ten animals and wanted to allow the user to say any of the animals’ names, it might build a language model containing ten phrases, each corresponding to an animal’s name. develop Issue 27 September 1996 8 Speech source Microphone Telephone Recognition system Application Feedback window Recognizer Active language model More language models Apple event handler pascal OSErr MyAEHandler (...) { ... } AIFF file AIFF Figure 1. How the Speech Recognition Manager works SRSpeechObject SRRecognitionSystem SRRecognizer SRSpeechSource SRLanguageObject SRWord SRPhrase SRPath SRLanguageModel SRRecognitionResult Figure 2. The speech object class hierarchy

Reading notes: Figure 1 and Figure 2 labels are diagram text whose reading order is uncertain

Printed dates
1996
Languages
English
PDF page 11

• SRRecognitionResult — When an utterance is recognized, an SRRecognitionResult object is sent (using either an Apple event or a callback routine, whichever the application prefers) to the application that was listening for that utterance. The SRRecognitionResult object describes what was recognized. An application can then look at the result in several forms: as text, as SRWords and SRPhrases, or as an SRLanguageModel, which can assist in quickly interpreting the uttered phrase. Each class of speech object has a number of properties that define how the objects behave. For example, all descendants of SRLanguageObject have a kSRSpelling property that shows how they’re spelled. Your application uses the SRSetProperty and SRGetProperty routines to set and get the various properties of each these objects. RELEASING OBJECT REFERENCES You create objects by calling routines like SRNewRecognizer and SRNewWord. When you’ve finished using them, you dispose of them by calling SRReleaseObject. You can also acquire references to existing objects by calling routines like SRGetIndexedItem (for example, to get the second word in a phrase of several words). The Speech Recognition Manager maintains a reference count for each object. An object’s reference count is incremented by SRNew… and SRGet… calls, and is decremented by calls to SRReleaseObject. An object gets disposed of only when its reference count is decremented to 0. Thus, to avoid memory leaks, your application must balance every SRNew… or SRGet… call with a call to SRReleaseObject. A SIMPLE SPEECH RECOGNITION EXAMPLE It’s easy to add simple speech recognition capabilities to your application. All you need to do is perform a small number of operations in sequence: 1. Initialize speech recognition by determining whether a valid version of the Speech Recognition Manager is installed, opening an SRRecognitionSystem, allocating an SRRecognizer, and installing an Apple event handler to handle recognition result notifications. 2. Build a language model that specifies the utterances your application is listening for. 3. Set the recognizer’s active language model to the one you built and call SRStartListening to start listening and processing recognition result notifications. We’ll describe each of these operations in more detail. INITIALIZING SPEECH RECOGNITION First, you must verify that a valid version of the Speech Recognition Manager is installed on the target machine. Listing 1 shows how to do this. Note that only versions 1.5 and later of the Speech Recognition Manager adhere to the API used in this article. Listing 2 shows how to open an SRRecognitionSystem, allocate an SRRecognizer, and install your Apple event handler. All of this happens when your application starts up. The Apple event handler HandleRecognitionDoneAE is shown later (in Listing 4). THE SPEECH RECOGNITION MANAGER REVEALED 9

Reading notes: Source appears to be a programming reference text, not advertising; headline not identifiable Version '1.5' appears in body text rather than as a printed date

Printed dates
1.5
Languages
English