I shouldn't have any trouble compiling emacs speak since I have a version of emacs already running. The lisp interpreter is the same. We will see. Ken -----Original Message----- From: programmingblind-bounce@xxxxxxxxxxxxx [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Dave Sent: Sunday, January 02, 2011 1:20 AM To: programmingblind@xxxxxxxxxxxxx Subject: Re: Mac python programming It's been a while lol...but looks like I went down the same road before. Here's my take on a server before. Mac has a native messaging loop (not sure what it is in terms of py objc context), but in objc it's NSRunLoop. Looks like you've found it though in apphelper. This server uses an http server to receive text from a client. Also, would be interested in your luck compiling emacspeak on Snow Leopard. """ begin server """ import string,cgi,time, urllib from os import curdir, sep, system from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer from AppKit import NSObject from AppKit import NSSpeechSynthesizer """ WebServer This script starts an http server and utilizes the Mac OS X speech synthesis framework to generate speech received through the browser as an url. """ class SpeechSynthesizerDelegate(NSObject): def speechSynthesizer_didFinishSpeaking_(self, synthesizer, success): sys.stdout.write("finished speaking") class MyHandler(BaseHTTPRequestHandler): speechSynthesizer = NSSpeechSynthesizer.alloc().init() delegate_ = SpeechSynthesizerDelegate.alloc().init(); def __init__(self, request, client_address, socket): MyHandler.speechSynthesizer.setRate_(500) MyHandler.speechSynthesizer.setDelegate_(MyHandler.delegate_) BaseHTTPRequestHandler.__init__(self, request, client_address, socket) def do_GET(self): MyHandler.speechSynthesizer.startSpeakingString_(urllib.unquote(self.path)) def main(): try: server = HTTPServer(('', 80), MyHandler) print 'started http server...' server.serve_forever() except KeyboardInterrupt: print '^C received, shutting down server' server.socket.close() if __name__ == '__main__': main() On 1/1/11, Ken Perry <whistler@xxxxxxxxxxxxx> wrote: > Oh one more thing Dave. I was planning to replace the main function part > with a socket loop that would take from the stdin and from a tcip socket > like the protocol says I just wanted to make sure the simple stuff worked > first. I didn't see a character speak method in NSSpeechSynthesizer either > did you? If not this his how I would add the function to that script I just > sent you to speak a character... If you add this right after the tts_say > function this will make > > Ttsserver l <character> > > Work. > > > #l c for speaking characters > def l(text): > voice = NSSpeechSynthesizer.defaultVoice() > speech = NSSpeechSynthesizer.alloc().initWithVoice_(voice) > speech.setDelegate_(SpeechDelegate.alloc().init()) > speech.startSpeakingString_(text) > funcs['l']=l > > -----Original Message----- > From: programmingblind-bounce@xxxxxxxxxxxxx > [mailto:programmingblind-bounce@xxxxxxxxxxxxx] On Behalf Of Dave > Sent: Saturday, January 01, 2011 9:05 PM > To: programmingblind@xxxxxxxxxxxxx > Subject: Re: Mac python programming > > Agreed on the crappy docs concerning this. > > Tried my hand at a speech server using py obj and had the *exact* same > problem. > Of course, implementing the delegate (NSSpeechSynthesizerDelegate if > memory serves), with all methods of the protocol yields no errors at > runtime; it simply just doesn't work. > Would be curious to see if anyone has an answer as well. > > On 1/1/11, Ken Perry <whistler@xxxxxxxxxxxxx> wrote: >> >> >> Has anyone created a command line application and made use of delegates > with >> pyobjc under Mac? I am working on a project that uses the >> NSSpeechSynthesizer class in coco and I can make the program talk fine > but >> I am not getting the didFinishSpeaking delegate message. If you know what > I >> am talking about I can send you some simple sample code to check and see > if >> I am doing this correct. I have to say the pyobjc documentation and > sample >> programs suck. >> >> >> >> Ken >> >> > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > > __________ > View the list's information and change your settings at > //www.freelists.org/list/programmingblind > > __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind __________ View the list's information and change your settings at //www.freelists.org/list/programmingblind