Re: [pygame] Voice Text To Speech and Wav File Make and Save
Hi Ian I could try it but would be looking at the the key-up. For you will note in my old event key char, or OnKey function I was looking ahead. That is OK and it worked with the elif list, but the textctrl edit field can have pointers that do not point to the actual text position. When reading on the subject, studying what methods textctrl had, I chose to use them instead for an easier, less code check. It also needed the key-up event so the pointer moves after releasing the key and by the time I catch the event the pointer is where it is to be and I just get the pointers and I am done. So, I added the onkey_up function to do just that. The function is much smaller and less time consuming except the check for word forward and back. There I needed to go and fetch all within a word to say the word. By doing this I use the key code to decide, which in all cases it is just the point in the line. Where the entire line read for up and down requires only to know the position and translating that using the built in function to convert to line and col, then the the entire line is loaded with another built in function and I get my line. The nice part about this is that I do check for end of line chars, which may vary with platform, In other words, single cr command, 13, for all others are lf, or 10 for line feed. When even going word forward and back it actually announces the end of line because it stops there and makes it all nicer. Anyway, thanks for the input, for trying to understand all the built in functions can be a little bit time consuming. But the more I write the easier it gets. I am using the wxpython for the buttons and frames are standard format, and my screen reader reads them as if it were a regular window. Now games are a different thing, for the people I write it to, the screen images is not that important. The Pygame window is seen by screen readers a just a single line just below the title bar. I have added another engine to my speech and it also uses the Sapi 4 voices and will load up to 28 voices. For your Vista to read it I think you have to fool Vista. But that has to be done before loading the speech engines. Sapi 4 and 5 do work together but only in XP, not Vista. Bruce Ian wrote: I use pygame.key.get_pressed(). I usually use the state of the input in question rather than deal with events. My generic input function looks like: def GetInput(): key = pygame.key.get_pressed() for event in pygame.event.get(): if event.type == QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): pygame.quit(); sys.exit() For your purposes, I now add: if event.type == KEYDOWN: text.append(event.key.name) mpress = pygame.mouse.get_pressed() mpos = pygame.mouse.get_pos() All untested (on vaction without a laptop); hope it works! Good luck, Ian #DRIVERS FOR SAPI 5 AND VOICES! #NOTE THE CONSTANTS AND IN THE SPEAK FUNCTION AND THE ADDING/OR OF THE VALUES. from comtypes.client import CreateObject import _winreg class constants4tts: Wait = -1 Sync = 0 Async = 1 Purge = 2 Is_filename = 4 XML = 8 Not_XML = 16 Persist = 32 Punc = 64 class SynthDriver(): name="sapi5" description="Microsoft Speech API version 5 (sapi.SPVoice)" _voice = 0 _pitch = 0 _voices = [] _wait = -1 #WAIT INDEFINITELY _sync = 0 #WAIT UNTIL SPEECH IS DONE. _async = 1 #DO NOT WAIT FOR SPEECH _purge = 2 #CLEAR SPEAKING BUFFER _is_filename = 4 #OPEN WAV FILE TO SPEAK OR SAVE TO WAV FILE _xml = 8 #XML COMMANDS, PRONUNCIATION AND GRAMMER. _not_xml = 16 #NO XML COMMANDS _persist_xml = 32 #Changes made in one speak command persist to other calls to Speak. _punc = 64 #PRONOUNCE ALL PUNCTUATION! def check(self): try: r=_winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,"SAPI.SPVoice") r.Close() return True except: return False #INITIALIZE ENGINE! def init(self): try: self.tts = CreateObject( 'sapi.SPVoice') self._voice=0 self._voiceCount = len(self.tts.GetVoices()) for v in range(self._voiceCount): self._voices.append( self.tts.GetVoices()[v]) return True except: return False #TERMINATE INSTANCE OF ENGINE! def terminate(self): del self.tts #NUMBER OF VOICES FOR ENGINE! def getVoiceCount(self): return len(self.tts.GetVoices()) #NAME OF A VOICE BY NUMBER! def getVoiceNameByNum(self, num): return self.tts.GetVoices()[ num].GetDescription() #NAME OF A VOICE! def getVoiceName(self): return self.tts.GetVoices()[ self._voice].GetDescription() #WHAT IS VOICE RATE? def getRate(self): "MICROSOFT SAPI 5 RATE IS -10 TO 10" return (self.tts.rate) #WHAT IS THE VOICE PITCH? def getPitch(self): "PITCH FOR MICROSOFT
[pygame] Voice Text To Speech and Wav File Make and Save
Hi! Does anyone have a good example on capturing key events? I got my text to speech to work better, will in the future remove the buttons and only have the file menu. It seems to work fine and now use sub menu's for voice settings. What will be needed as an event to capture the cursor movement inside the text box. How do I get the key and cursor events so I can speak when doing ctrl cursor or up/down cursor events to say lines, words, and letters? I have tried getting the key event but gets ignored, so I need the proper kind and location to catch the text box key events. I erased my test, but below and attached are the complete setup. Bruce desc="""Using two nested sizers, the main one with vertical layout and the embedded one with horizontal layout For setting voice parms:""" #Editor.py import wx import os import Sapi5 tts = Sapi5.Create( {"name":"Mary"}) purge = tts._purge async = tts._async punc = tts._punc MN=0 ID=1 HK=2 KD=3 MF=4 MF2=5 DW_ID=1000 class MainWindow(wx.Frame): def __init__(self, parent, id, title): self.dirname=os.getcwd() #SEARCH FROM PRESENT DIRECTORY! self.filename="" self.items4menu = {"File": [ {MN:"Open", ID:102, HK:"&Open", KD:" Open a file to edit", MF:self.OnOpen}, {MN:"Save", ID:103, HK:"&Save", KD:" save file to disk", MF:self.OnSave}, {MN:"Edit", ID:104, HK:"&Edit", KD:" Do editing", MF:self.OnEdit}, {MN:"About", ID:101, HK:"&About", KD:" Information about this program", MF:self.OnAbout}, {MN:"Exit", ID:109, HK:"E&xit", KD:" Terminate the program", MF:self.OnExit} ], #END OF FILE MENU! "Voice": [ {MN:"Read", ID:202, HK:"&Read", KD:" Open a file to read", MF:self.OnWav2Read}, {MN:"Save", ID:203, HK:"&Save", KD:" save text to audio file", MF:self.OnSave2Wav}, {MN:"Text", ID:204, HK:"Te&xt", KD:" read text field", MF:self.OnRead}, {MN:"Quit", ID:205, HK:"&Quit", KD:" Stop Reading", MF:self.OnQuitRead} ], #END OF VOICE MENU! "Settings": [ {MN:"Voice", ID:302, HK:"&Speaker", KD:" Name for voice.", MF:self.OnVoice, MF2:self.OnClick}, {MN:"Rate", ID:303, HK:"&Rate", KD:" Rate for voice.", MF:self.OnVoice, MF2:self.OnClick}, {MN:"Pitch", ID:304, HK:"&Pitch", KD:" Pitch for voice.", MF:self.OnVoice, MF2:self.OnClick}, {MN:"Volume", ID:305, HK:"&Volume", KD:" Volume for voice.", MF:self.OnVoice, MF2:self.OnClick} ], #END OF SETTINGS MENU! "Down": [ {MN:"Down", ID:DW_ID, HK:"&Down", KD:" Lower Setting.", MF:self.OnVoice, MF2:self.OnClick} ] #END OF DOWN MENU! } #END OF ITEMS FOR MENU! self.buttons4voice = [ {MN:"Voice", ID:111, HK:"&Voice", KD:" Voice Change", MF:self.OnEnter, MF2:self.OnClick}, {MN:"Rate", ID:112, HK:"&Rate", KD:" Rate For Voice Adjust", MF:self.OnEnter, MF2:self.OnClick}, {MN:"Pitch", ID:113, HK:"&Pitch", KD:" Pitch Of Voice Adjust", MF:self.OnEnter, MF2:self.OnClick}, {MN:"Volume", ID:114, HK:"&Loudness", KD:" Volume Loudness Adjust", MF:self.OnEnter, MF2:self.OnClick} ] #END OF ITEM FOR BUTTONS! wx.Frame.__init__(self, parent, wx.ID_ANY, title) self.control = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE) self.CreateStatusBar() #A Statusbar in the bottom of the window #Setting up the menu. filemenu = wx.Menu() for o in self.items4menu["File"]: filemenu.Append( o[ID], o[HK], o[KD]) filemenu.AppendSeparator() voicemenu = wx.Menu() for o in self.items4menu["Voice"]: voicemenu.Append( o[ID], o[HK], o[KD]) voicemenu.AppendSeparator() setting_menu = wx.Menu() for o in self.items4menu["Settings"]: down_menu = wx.Menu() down_menu.Append( o[ID], o[HK], o[KD]) d = self.items4menu["Down"][0] down_menu.Append( d[ID]+o[ID], d[HK], d[KD]) setting_menu.AppendMenu( o[ID], o[HK]+" Setting", down_menu) setting_menu.AppendSeparator() voicemenu.AppendMenu(-1, "&VoiceSettings", setting_menu) # Creating the menubar. menuBar = wx.MenuBar() menuBar.Append( filemenu,"&File") # Adding the "filemenu" to the MenuBar menuBar.Append( voicemenu,"&Voice") # Adding the "voicemenu" to the MenuBar self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content. self.data4menu = {} for o in self.items4menu["File"]: wx.EVT_MENU(self, o[ID], o[MF]) self.data4menu[ o[ID]] = o for o in self.items4menu["Voice"]: wx.EVT_MENU(self, o[ID], o[MF]) self.data4menu[ o[ID]] = o for o in self.items4menu["Settings"]: wx.EVT_MENU(self, o[ID], o[MF]) self.data4menu[ o[ID]] = o wx.EVT_MENU(self, o[I
Re: [pygame] Mixer Quit / Restart
Hi! It never worked, it is just that it never worked. Wyatt Olson To: pygame-users@seul.org This appears to get the total number of channels, not the number of active channels. However, I tried using get_busy(), but it still does not seem to work. See the following modifications to my original code: import pygame, time for x in range(10): print("Starting iteration " + str(x)) print("Initializing mixer") pygame.mixer.init() print("Loading sound") sound = pygame.mixer.Sound("foo.wav") print("Finding free channel") channel = pygame.mixer.find_channel() print("Channel object: " + str(channel)) print("Setting volume") channel.set_volume(0.7) print("Playing sound") channel.play(sound) print("Sleeping until sound is finished playing...") while pygame.mixer.get_busy(): time.sleep(1) print("Quitting mixer\n\n") pygame.mixer.quit() This displays the same behaviour. In response to a previous comment about using channel.stop() before quitting the mixer: this does not work either, as can be seen by adding channel.stop() after the get_busy loop above. Has anyone tried running this code themselves? I am wondering if I am experiencing some obscure bug, possibly platform specific. I am running on OS X, but don't have access to other systems for troubleshooting. If someone else has access to a Windows or Linux box, and is able to prove if this fails on those systems as well, that may be useful. Cheers Ian Mallett wrote: On 7/2/08, Wyatt Olson <[EMAIL PROTECTED]> wrote: Is there anything which can return a list of all currently active channels? pygame.mixer.get_num_channels() This returns 0 if none are playing and > 0 if there are.
[pygame] A SAPI Module With Pitch and Create
Hi! I have made a SAPI 5 module for those who are blind/visually impaired programmers. I have reduced down and added a few features into the SAPI 5 speech module I have created. You can now save and read wav files. The test module tests most of the features I have in it at the moment. The module has not got as much in it as the pyTTS module does, but it is small and uses the windows SAPI 5 that is already installed in XP/Vista computers. I added the ability inside the Create method to set all the voice parameters. You can change the voice, volume, rate, and pitch in the Create method. They are dict values and just assign the values you want. Pitch and rate are from -10 to 10 with 0 the norm. Where the volume is from 0% to 100% but do not use the (%) symbol, just the integer number. The default for change is 0 for any of the values and the default voice will be the first on the list, which is Sam if you are using the Microsoft SAPI 5 voices. The names are listed in the test. So assignment depends on what you have installed onto your machine. I have not changed any usage of eSpeak voices to allow pitch adjustment yet. An error comes up for those voices because I have not looked into what it wants. This SAPI 5 engine will at least allow you to get started and includes the methods saving and reading a wav file. The wav methods are .SpeakToWav and SpeakFromWav so you could use it for other possible things, such as web sites and games. Enjoy testing it. I have not played with the bookmark method yet. Bruce #DRIVERS FOR SAPI 5 AND VOICES! #NOTE THE CONSTANTS AND IN THE SPEAK FUNCTION AND THE ADDING/OR OF THE VALUES. from comtypes.client import CreateObject import _winreg class constants4tts: Wait = -1 Sync = 0 Async = 1 Purge = 2 Is_filename = 4 XML = 8 Not_XML = 16 Persist = 32 Punc = 64 class SynthDriver(): name="sapi5" description="Microsoft Speech API version 5 (sapi.SPVoice)" _voice = 0 _pitch = 0 _voices = [] _wait = -1 #WAIT INDEFINITELY _sync = 0 #WAIT UNTIL SPEECH IS DONE. _async = 1 #DO NOT WAIT FOR SPEECH _purge = 2 #CLEAR SPEAKING BUFFER _is_filename = 4 #OPEN WAV FILE TO SPEAK OR SAVE TO WAV FILE _xml = 8 #XML COMMANDS, PRONUNCIATION AND GRAMMER. _not_xml = 16 #NO XML COMMANDS _persist_xml = 32 #Changes made in one speak command persist to other calls to Speak. _punc = 64 #PRONOUNCE ALL PUNCTUATION! def check(self): try: r=_winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,"SAPI.SPVoice") r.Close() return True except: return False #INITIALIZE ENGINE! def init(self): try: self.tts = CreateObject( 'sapi.SPVoice') self._voice=0 self._voiceCount = len(self.tts.GetVoices()) for v in range(self._voiceCount): self._voices.append( self.tts.GetVoices()[v]) return True except: return False #TERMINATE INSTANCE OF ENGINE! def terminate(self): del self.tts #NUMBER OF VOICES FOR ENGINE! def getVoiceCount(self): return len(self.tts.GetVoices()) #NAME OF A VOICE BY NUMBER! def getVoiceNameByNum(self, num): return self.tts.GetVoices()[num-1].GetDescription() #NAME OF A VOICE! def getVoiceName(self): return self.tts.GetVoices()[ self._voice].GetDescription() #WHAT IS VOICE RATE? def getRate(self): "MICROSOFT SAPI 5 RATE IS -10 TO 10" return (self.tts.rate) #WHAT IS THE VOICE PITCH? def getPitch(self): "PITCH FOR MICROSOFT SAPI 5 IS AN XML COMMAND!" return self._pitch #GET THE ENGINE VOLUME! def getVolume(self): "MICROSOFT SAPI 5 VOLUME IS 1% TO 100%" return self.tts.volume #GET THE VOICE NUMBER! def getVoiceNum(self): return self._voice #SET A VOICE BY NAME! def setVoiceByName(self, name): "VOICE IS SET BY NAME!" for i in range( self._voiceCount): if self.tts.GetVoices()[ i].GetDescription().find( name) >= 0: self.tts.Voice = self._voices[i] #self.tts.Speak( "%s Set!" % name) self._voice=i break if i >= self._voiceCount: self.tts.Speak( "%s Not Found!" % name) #USED FOR BOOKMARKING AND USE LATER! def _get_lastIndex(self): bookmark=self.tts.status.LastBookmark if bookmark!="" and bookmark is not None: return int(bookmark) else: return -1 #NOW SET ENGINE PARMS! #SET THE VOICE RATE! def setRate(self, rate): "MICROSOFT SAPI 5 RATE IS -10 TO 10" if rate > 10: rate = 10 if rate < -10: rate = -10 self.tts.Rate = rate #SET PITCH OF THE VOICE! def setPitch(self, value): "MICROSOFT SAPI 5 pitch is really controled with xml around speECH TEXT AND IS -10 TO 10" if value > 10: value
Re: [pygame] Using SAPI 5 Voices and Methods
As a note to this message post: the error I was getting for both the spell and the isfilename was traced down to simple factors. One problem is finding clear explanations and then checking the erroor codes. I found both on the issues mentioned about the SAPI 5 issues. The test I was running and encountered an error with the spell command came from using 2 different type voice packages as one. What I am saying is that I had the 3 Microsoft voices Sam, Mike, and Mary loaded in with 6 eSpeak voices and the error came when I did a test using the eSpeak voice. Once I used the Microsoft voice the error went away. The error I traced to being a unsupported operator type in the ctypes error list: WorkflowConditionOperatorNotSupported -2147201006 "Condition operator not supported for specified type." Error List: http://msdn.microsoft.com/en-us/library/cc151248.aspx The other error came from the open file command, which when using XML commands it is an Internet, Navigator error. When trying to understand the commands and the formats I could not truely understand what was being said, so I thought it could read a text.txt file but it does not. The isfilename comand is for reading a .wav file only. So I got rid of an flags except the isfilename flag, or 4 on the list and it worked. It will also work for sync or async, but you have to understand what each flat means and what it blocks. So this is the error description when using a wrong file type in the sapi XML ISFILENAME flag: List Of Error Codes: http://msdn.microsoft.com/en-us/library/aa768365(VS.85).aspx NavigateError Event Status Codes This page lists the possible values for the StatusCode parameter of the DWebBrowserEvents2::NavigateError -2146697203 INET_E_UNKNOWN_PROTOCOL (0x800C000DL or -2146697203) There a lot of error codes on both lists and you just have to search the code number you wish to find. I am posting this for anyone that may encounter such errors when using SAPI 5 commands. Sent: Monday, June 16, 2008 11:38 PM Subject: [pygame] Using SAPI 5 Voices and Methods Hi! I guess in some cases the email message gets messed up so I attached the SAPI 5 test for voices along with an HTML version using Java Script. It also has the methods and a voice by name assignment since the voices are an array list by element. So I use the description to find the name. It also lists the voice names in the console field. I guess you could also use the pyTTS version as well. I did have one problem and that was the isfilename flag seems to get an error. But, also my spell tag did not work on my tower computer, but did work on my Lap Top. Do not know why, but it could be a version issue. Yet the isfilename also does not work on the Lap Top, so who knows. Anyway, have fun and install if for either your games or web pages... Bruce
[pygame] Using SAPI 5 Voices and Methods
Hi! I guess in some cases the email message gets messed up so I attached the SAPI 5 test for voices along with an HTML version using Java Script. It also has the methods and a voice by name assignment since the voices are an array list by element. So I use the description to find the name. It also lists the voice names in the console field. I guess you could also use the pyTTS version as well. I did have one problem and that was the isfilename flag seems to get an error. But, also my spell tag did not work on my tower computer, but did work on my Lap Top. Do not know why, but it could be a version issue. Yet the isfilename also does not work on the Lap Top, so who knows. Anyway, have fun and install if for either your games or web pages... Bruce #THE NEXT TO LAST TEST IS THE ISFILE AND I COMMENTED IT OUT FOR THERE IS AN ERROR! import Sapi5, time, os av = Sapi5.SynthDriver() av.init() SYNC = av._sync ASYNC = av._async PURGE = av._purge ISFILE = av._is_filename XML = av._xml NOT_XML = av._not_xml PERSIST = av._persist_xml PUNC = av._punc WAIT = av._wait av.Speak("Hello!") av.Speak( "I am speaking in the default voice!") av.Speak( "Number of voices is: %d" % av.getVoiceCount()) av.Speak( "Hello! Now saying the punctuation in this sentence.", PUNC) time.sleep(.5) av.setVoiceByName( "Mike") av.setVolume( 100) av.Speak( " The Volume Is Set At Speaker Volume!") av.setRate( 5) av.setPitch(0) av.setVoiceByName( "Mary") av.setPitch(5) av.Speak( "Set To Voice Mary and Pitch 5 or 75% of maximum pitch!") time.sleep(1) av.setPitch(0) av.setRate(0) av.Speak( "The rate and pitch are now set for normal!") time.sleep(1) av.read_Voices() av.setVoiceByName( "Mary") av.Speak( "Hit enter key to stop speaking!") av.setPitch(10) av.Speak("Pitch 100%", ASYNC) av.setPitch(5) av.Speak("Pitch 75%", ASYNC) av.setPitch(0) av.Speak("Pitch 50%", ASYNC) av.setPitch( -5) av.Speak("Pitch 25%", ASYNC) av.setPitch( -10) av.Speak("Pitch 0%", ASYNC) av.setPitch(0) av.Speak( "Hit enter key!", ASYNC) hit = raw_input("Hit enter key >") #av.SpeakFile( "readthis.txt", ASYNC, ISFILE) av.Speak(" Now Good bye", ASYNC, PURGE) av.setVoiceByName( "Sam") av.Speak( " goodbye") #DRIVERS FOR SAPI 5 AND VOICES! #NOTE THE CONSTANTS AND IN THE SPEAK FUNCTION AND THE ADDING/OR OF THE VALUES. from comtypes.client import CreateObject import _winreg class constants4tts: Wait = -1 Sync = 0 Async = 1 Purge = 2 Is_filename = 4 XML = 8 Not_XML = 16 Persist = 32 Punc = 64 class SynthDriver(): name="sapi5" description="Microsoft Speech API version 5 (sapi.SPVoice)" _pitch = 0 _voices = [] _wait = -1 #WAIT INDEFINITELY _sync = 0 #WAIT UNTIL SPEECH IS DONE. _async = 1 #DO NOT WAIT FOR SPEECH _purge = 2 #CLEAR SPEAKING BUFFER _is_filename = 4 #OPEN WAV FILE TO SPEAK OR SAVE TO WAV FILE _xml = 8 #XML COMMANDS, PRONUNCIATION AND GRAMMER. _not_xml = 16 #NO XML COMMANDS _persist_xml = 32 #Changes made in one speak command persist to other calls to Speak. _punc = 64 #PRONOUNCE ALL PUNCTUATION! def check(self): try: r=_winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,"SAPI.SPVoice") r.Close() return True except: return False #INITIALIZE ENGINE! def init(self): try: self.tts = CreateObject( 'sapi.SPVoice') self._voice=1 self._voiceCount = len(self.tts.GetVoices()) for v in range(self._voiceCount): self._voices.append( self.tts.GetVoices()[v]) return True except: return False #TERMINATE INSTANCE OF ENGINE! def terminate(self): del self.tts #NUMBER OF VOICES FOR ENGINE! def getVoiceCount(self): return len(self.tts.GetVoices()) #NAME OF A VOICE NUMBER! def getVoiceName(self, num): return self.tts.GetVoices()[num-1].GetDescription() #WHAT IS VOICE RATE? def getRate(self): "MICROSOFT SAPI 5 RATE IS -10 TO 10" return (self.tts.rate) #WHAT IS THE VOICE PITCH? def getPitch(self): "PITCH FOR MICROSOFT SAPI 5 IS AN XML COMMAND!" return self._pitch #GET THE ENGINE VOLUME! def getVolume(self): "MICROSOFT SAPI 5 VOLUME IS 1% TO 100%" return self.tts.volume #GET THE VOICE NUMBER! def getVoiceNum(self): return self._voice #SET A VOICE BY NAME! def setVoiceByName(self, name): "VOICE IS SET BY NAME!" for i in range( self._voiceCount): vp = self.tts.GetVoices()[ i].GetDescription().find( name) if vp>0: self.tts.Voice = self._voices[i] #self.tts.Voice = self.tts.GetVoices()[i] self.tts.Speak( "%s Set!" % name) self._voice=i+1 break if i >= self._voiceCount: self.tts.Speak( "%s Not Found!" % name) #USED FOR BOOKMARKING AND USE LATER! def _get_lastIndex(self):
Re: [pygame] Using SAPI 5 Voices and Methods
Hi! No, but maybe, pytts has no pitch method. This is just for those who wish to have just the sapi 5 directly. Is this related to PyTTS? -- Jake
[pygame] Using SAPI 5 Voices and Methods
Hi! Below is the settings to use the built in SAPI 5 voices. It will also read any other voices loaded into the SAPI 5 and stores the list of all of them. You can change the names of the methods if you so desire. I am giving you an example of how to set up your voices. NOTE: The pitch of the voices has to be an XML command and it is built into the speech or Speak method. You will need to understand the XML commands if you wish to use the added XML features. Pitch is just one and there is one for spell, bookmarks, and so on... Bruce #DRIVERS FOR SAPI 5 AND VOICES! #NOTE THE CONSTANTS AND IN THE SPEAK FUNCTION AND THE ADDING/OR OF THE VALUES. from comtypes.client import CreateObject import _winreg class constants4tts: Wait = -1 Sync = 0 Async = 1 Purge = 2 Is_filename = 4 XML = 8 Not_XML = 16 Persist = 32 Punc = 64 class SynthDriver(): name="sapi5" description="Microsoft Speech API version 5 (sapi.SPVoice)" _pitch = 0 _voices = [] _wait = -1 #WAIT INDEFINITELY _sync = 0 #WAIT UNTIL SPEECH IS DONE. _async = 1 #DO NOT WAIT FOR SPEECH _purge = 2 #CLEAR SPEAKING BUFFER _is_filename = 4 #OPEN WAV FILE TO SPEAK OR SAVE TO WAV FILE _xml = 8 #XML COMMANDS, PRONUNCIATION AND GRAMMER. _not_xml = 16 #NO XML COMMANDS _persist_xml = 32 #Changes made in one speak command persist to other calls to Speak. _punc = 64 #PRONOUNCE ALL PUNCTUATION! def check(self): try: r=_winreg.OpenKey(_winreg.HKEY_CLASSES_ROOT,"SAPI.SPVoice") r.Close() return True except: return False #INITIALIZE ENGINE! def init(self): try: self.tts = CreateObject( 'sapi.SPVoice') self._voice=1 self._voiceCount = len(self.tts.GetVoices()) for v in range(self._voiceCount): self._voices.append( self.tts.GetVoices()[v]) return True except: return False #TERMINATE INSTANCE OF ENGINE! def terminate(self): del self.tts #NUMBER OF VOICES FOR ENGINE! def getVoiceCount(self): return len(self.tts.GetVoices()) #NAME OF A VOICE NUMBER! def getVoiceName(self, num): return self.tts.GetVoices()[num-1].GetDescription() #WHAT IS VOICE RATE? def getRate(self): "MICROSOFT SAPI 5 RATE IS -10 TO 10" return (self.tts.rate) #WHAT IS THE VOICE PITCH? def getPitch(self): "PITCH FOR MICROSOFT SAPI 5 IS AN XML COMMAND!" return self._pitch #GET THE ENGINE VOLUME! def getVolume(self): "MICROSOFT SAPI 5 VOLUME IS 1% TO 100%" return self.tts.volume #GET THE VOICE NUMBER! def getVoiceNum(self): return self._voice #SET A VOICE BY NAME! def setVoiceByName(self, name): "VOICE IS SET BY NAME!" for i in range( self._voiceCount): vp = self.tts.GetVoices()[ i].GetDescription().find( name) if vp>0: self.tts.Voice = self._voices[i] #self.tts.Voice = self.tts.GetVoices()[i] self.tts.Speak( "%s Set!" % name) self._voice=i+1 break if i >= self._voiceCount: self.tts.Speak( "%s Not Found!" % name) #USED FOR BOOKMARKING AND USE LATER! def _get_lastIndex(self): bookmark=self.tts.status.LastBookmark if bookmark!="" and bookmark is not None: return int(bookmark) else: return -1 #NOW SET ENGINE PARMS! #SET THE VOICE RATE! def setRate(self, rate): "MICROSOFT SAPI 5 RATE IS -10 TO 10" if rate > 10: rate = 10 if rate < -10: rate = -10 self.tts.Rate = rate #SET PITCH OF THE VOICE! def setPitch(self, value): "MICROSOFT SAPI 5 pitch is really controled with xml around speECH TEXT AND IS -10 TO 10" if value > 10: value = 10 if value < -10: value = -10 self._pitch=value #SET THE VOICE VOLUME! def setVolume(self, value): "MICROSOFT SAPI 5 VOLUME IS 1% TO 100%" self.tts.Volume = value #CREATE ANOTHER INSTANCE OF A VOICE! def createVoice(self, value=1): if value > self.getVoiceCount: value = self.getVoiceCount if value < 1: value = 1 new_tts = CreateObject( 'sapi.SPVoice') return (new_tts.GetVoices()[ value-1]) #SPEAKING TEXT! #SPEAK TEXT USING BOOKMARKS AND PITCH! def SpeakText(self, text, wait=False, index=None): "SPEAK TEXT AND XML FOR PITCH MUST REPLACE ANY <> SYMBOLS BEFORE USING XML BRACKETED TEXT" flags = constants4tts.XML text = text.replace( "<", "<") pitch = ((self._pitch*2)-100)/10 if isinstance(index, int): bookmarkXML = "" % index #NOTE \" FOR XML FORMAT CONVERSION! else: bookmarkXML = "" flags = constants4tts.XML if wait is False: flags += constants4tts.Async sel
Re: [pygame] pygame in wxNotebook
Hi! I guess one approach would be to use OcempGUI http://ocemp.sourceforge.net/manual/manual.html From: Astan Chee Hmm, Im stuck then. I need my game to have texboxes, comboboxes, labels and various other text-input widgets. Can pygame do this easily as I do it in wx? Im not sure how to use gtk or tk or even qt to integrate it with pygame the way I want it to, but Im rather hesitant since Im not familiar with it. Any suggestions? Thanks again René Dudfield wrote: hi, using two gui toolkits together often won't work. http://pygame.org/wiki/gui Using wxpython with pygame is unsupported - since no one can seem to get it working nicely. cheers, On Thu, Apr 24, 2008 at 10:55 AM, Astan Chee <[EMAIL PROTECTED]> wrote: Hi, Im trying to put a pygame window as one of a tabs of a wxNotebook. I've attached my code but somehow the pygame window doesnt seem to attach itself. What am I doing wrong? or cant I do this/pygame doesnt allow it? Im using wxpython 2.6.3.3 and pygame 1.7.1 on windows. Thanks for any help Astan -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Animal Logic http://www.animallogic.com Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. -- "Formulations of number theory: Complete, Consistent, Non-trivial. Choose two." Please think of the environment before printing this email. This email and any attachments may be confidential and/or privileged. If you are not the intended recipient of this email, you must not disclose or use the information contained in it. Please notify the sender immediately and delete this document if you have received it in error. We do not guarantee this email is error or virus free. No virus found in this incoming message. Checked by AVG. Version: 7.5.524 / Virus Database: 269.23.3/1393 - Release Date: 4/23/2008 8:12 AM
Re: [pygame] Images and Movies
Hi Ian, Yes, and also sound recording for pygame because the web site showed only playing options, no recording... Bruce Hi, Given some image files, how can you convert them to get a movie file using Python? I'm hoping it can be done in PyGame, though perhaps not. In the latter event, I need the source files, so that there are not extra dependencies. Thanks, Ian
Re: [pygame] Python and Speed
Ian, Below is a simple check knowing only the angle of the vector. The while loop is moving along that vector in steps. Now this is what is needed inside a normal screen with 2 or more objects. For the angle between them is what is being used here. This assumes one is static and one moving, but that also can be compensated for by drawing the point where they meet, which is still direction, and still the same ending point where both agree, or are the same. In other words, the static point where they are both going to meet eventually. The while loop steps through to the full length of the vector, but that is not needed if you no the distance to the outer edge of your object. For if you know the angle, the distance to the outer edge of your object surface then you compare the point created by this vector. Once the point is the same for both objects, then you have a collision. Not tracking pixels for a merge, but just the distance to the outer edge of the object you have based on the angle between them. So this is the simplest way and least time consuming way to find collisions. Granted it is fun and neat to use pixels, but is that really necessary? I guess if your trying to find the edge of your object based on angle, you may have to do that to find where the color changes, but is that necessary? Like having a mapping of each object and over-laying the angle onto it then finding the edge is how to find that edge point. But, once the edge based on the angle is found, then comparison of the same point is when the collision has happened. Your static object copy will have an edge point changing based on the angle, so trace that change based on angle. Only a few math steps required, not a sweeping massive array of all pixels... My grid used is an 8X8 matrix but that can easily be replaced with the screen coordinates values, like 900X900, for the angle and final landing point on that matrix is all were talking about. Now to get within a pixel area, then expand the screen size outward, like instead of 900X900 make it 9000X9000 and if the area falls within 801X802 then expanded out we will fall within 8010 and 8020, or within 10 which is like saying we have fallen within a box 10X10 so as not to be exact on calculations and allowing for rounding factors... This module is used for all calculations, including weapon firing that travels through space also, ship movement, and even landing at Star Bases, or commonly referred to as Docking. def NAV(GG, SS, Dir, Warp): "NAVIGATE USING ONLY AN ANGLE FROM A GIVEN SHIP, IN A GIVEN GALAXY/TABLE!" Angle = GG.Dir2Ang( Dir) # CONVERT DIRECTION BACK TO ANGLE! qy = SS.Qy qx = SS.Qx sy = SS.Sy sx = SS.Sx z = 1.0 Hit = 0 last4sx = sx last4sy = sy last4z =2 Warp = float( Warp) #TO MAKE SURE THE NUMBER IS A NUMBER AND NOT TEXT! Sin = sin(Angle) #opposite over hypotenuse, VECTOR! GG.SIN = Sin #GLOBAL VARIABLE! Cos = cos(Angle) #ADJACENT OVER HYPOTENUSE, VECTOR! GG.COS = Cos #GLOBAL VARIABLE! #SET TO PLAY SOUND AS IT TRAVELS! # Clear_Wait() #MAY SET IF ANY STOP PLAY NEEDED! if GG.COM=="TOR": print "The %s Is Now Firing " % SS.N, SS.T -= 1 if SS.IMG==GG.ESI: ps = randint(1,3) if ps == 1: print "Photon Torpedos!"; PlaySound( "Federation_Photons.ogg", 0, .8) elif ps >= 2: print "Quantom Torpedos!"; PlaySound( "Federation_Quantums.ogg", 0, .8) else: ps = randint(1,4) if ps == 1: print "Photon Torpedos!"; PlaySound( "Klingon_Photons.ogg", 0, 1.2) elif ps == 2: print "Cardassian Photon Torpedos!"; PlaySound( "Cardassian_Photons.ogg", 0, 1.2) elif ps >= 3: print "Romulan Photon Torpedos!"; PlaySound( "Romulan_Photons.ogg", 0, 1.2) if GG.COM=="PHA": print "The %s Is Now Firing " % SS.N, SS.P -= SS.P/10.0 if SS.IMG==GG.ESI: print "Phasers!"; PlaySound( "Federation_Phaser.ogg", 0, 3) else: ps = randint(1,5) if ps == 1: print "Klingon Disruptors!"; PlaySound( "Klingon_Disruptor.ogg", 0, 1.2) elif ps == 2: print "Cardassian Disruptors!"; PlaySound( "Cardassian_Disruptor.ogg", 0, 1.2) elif ps >= 3: print "Romulan Disruptors!"; PlaySound( "Romulan_Disruptor.ogg", 0, 1.2) elif ps >= 4: print "Phasers!"; PlaySound( "Defiant_Phaser.ogg", 0, 3.5) #UPDATE THE STAR DATE BASED ON WARP! if GG.COM=="NAV": #START ENGINES, SET ENERGY, AND STARDATE! SS.E -= Warp*10.0 +10.0 if SS.IMG==GG.ESI: GG.SAFE = 0 GG.SDT += Warp print "Command(%s) %s" % (GG.COM, SS.N) print " Moving From Quadrant(%d,%d) Sector(%d,%d) At DIR: %1.2f WARP: %2.2f" % (qy,qx,sy,sx, Dir, Warp) PlaySound( "Federation_Warp.ogg", 0, -1) if SS.IMG == GG.ESI and GG.COM != "TAR":
Re: [pygame] Python and Speed
Hi! I guess we could talk any language to death on speed, but being smart on how to speed up the existing one is the best approach. As I said, Ian could use the example I gave him and the other comments which he has already said he does. The distance instead of the square root for that is meaningless when comparing. But when you want to find the pixel (x,y,z) then you do have to use the square root to get the outer edge exact point. So the object has a vector, speed and direction. That direction has an intersection point, so the triangle formed also merges between the object centers. So the line drawn between object centers will intersect a location on each surface at some point. So, monitor that point by changing it to a key in a dictionary: key = str(x)+str(-y)+str(-z) Those points, only 2, are changing as the objects approach each other based on that angle drawn with the vector. The only thing that is a variant besides the triangle being formed with the vector is the objects outer edge, for if it is an irregular shaped object, then you have some work to do to calculate that point. Maybe the only static array is the objects actual shape in memory which can give you the distance based on the radii drawn to it from the object center... So any person can speed up there game by just using some simple trig... Bruce True, although that constant is often on the order of 20, and 40 FPS is a lot different than 2FPS. --Mike Casey Duncan wrote: > On Apr 18, 2008, at 9:23 AM, Ian Mallett wrote: >> OK, my point here is that if C languages can do it, Python should be >> able to too. I think all of this answers my question about why it >> isn't... > > C can do what? C is, at best, a constant time improvement in > performance over python. A bad algorithm in Python is also a bad > algorithm in C. > > It's all well and good to think that Python should be as fast as C, > but no one is going to take you seriously unless you have a specific > proposal, preferably with an implementation that proves its merit. > Otherwise it's just wishful thinking. > > But the larger point is that making things run faster is not an > panacea, reducing the algorithmic complexity is the best solution. > Make sure you have the best algorithm before you worry about reducing > the constant time factors. > > -Casey >
Re: [pygame] Python and Speed
Hi! Another thought, same as before but adding the other comment about bins. If your object is heading in a certain direction and you know the surface point of that object, now make a dictionary key point for it. Same for all other objects, knowing there direction. key=str(x)+str(-y)+str(-z) #Keeping all as integer values in a coordinate grid. The only thing you compare are the keys. Then you will say, wait a minute, not both are going to collide at that point! OK, then you know the direction of both and the point where they would in fact collide. Now that point will be approaching both at the same point in that straight line. The vertex of the point may change where they intersect, but keep taking the key value of that point because both will always have that vertex point on that point on the surface. Keep updating the dictionary key and compare the value for both with the if key in... That point is a key value and easy to check. It is not the surface, just the intersection point of both straight lines of the object traveling through free space... So you will be checking 2 keys for 2 objects, 3 keys for 3 objects, and so on... The only addition to this is if you have an object that is not perfect shape, like a boulder, where that outer edge will change depending on the angle of your straight line to the vertex or intersection point. Not checking surfaces, just checking the intersection point of the line, for both will have to meet and the distance to that objects surface will also be that straight line distance for the object center, which will still direct you to the vertex/intersection point. Both surface points that meet, have same key value, will also be the collision point when they do in fact collide... So all points will match, just another observation and thought in this faster and faster check of objects. For I do something like this with my primitive Battleship game. Instead of an array, just keys for where an object part is located. When the missile or shell hits that key it matches the objects location at that same key. No completely filled huge array, just points. When doing this you have up to 3 points to calculate: point of surface of object 1, point on surface of object 2 and then the intersection point of the vector of both objects. When all 3 points match with the same key, you have your collision! Like I said before, the updating is the vector angle, surface location and the intersection point of that straight line of the vectors of both objects. Bruce René Dudfield wrote: > - SIMD instructions are the fast ones... It's doubtful there's much in the Python core that would benefit from SIMD, though. Most of what it does doesn't involve doing repetitive operations on big blocks of data. -- Greg
Re: [pygame] Python and Speed
Hi! I am just making an observation on this and objects, maybe I am missing the point, but when checking collisions, if you know your objects size, the vertex, or point depending on direction, could you not not solve this by just the direct line between the 2 objects and not the surface? What I mean, you are in control of your game, you know your objects, thus, you also know the point that will be hit depending on the direction you are traveling in, so why not just check that point or small collection of points? That is what I would do when running this kind of game. For my Star Trek game does not use the actual pixel, but the area in which it is in and that is a larger area. But when using pixel points, then only the points that fall in-line with the direction you are traveling in. That seems to me to a much faster check, little to almost 1 single point is what seems to be the result in this... In other words you know your objects and where they are, then just draw a straight line between them and calculate the edge at that line drawn. I am not saying draw a line, just calculate to the edge of the object from both... Bruce On Apr 17, 2008, at 12:26 PM, Ian Mallett wrote: > On Thu, Apr 17, 2008 at 12:15 PM, Casey Duncan <[EMAIL PROTECTED]> > wrote:Note this is not the most efficient way to do this, using a > partitioned space you may be able to avoid comparing most points > with one another most of the time. To do this in 2D you could use > quad-trees, in 3D you could use oct-trees. See: http://en.wikipedia.org/wiki/Octree > Yes, I've tried this, but there are issues with points being in two > separate places. For example, if the collision radius is 5, and it > is 3 away from the edge, then all the points in the neighboring > trees must be tested. Partitioned space is certainly a more complex algorithm, but so long as all of your "points" (spheres?) are not close together, it is usually vastly more efficient. If the partition size is optimal, than the vast majority of particles will not be hitting the edge of a partition, that will be an edge-case (pun intended). Even for those that are it's usually still faster than the naive O(N^2) method that compares every point with every other. This algorithm is only effective if the space is large relative to the collision geometries and they tend not to be clumped very close together. -Casey
Re: Re: [pygame] Python and Speed
Hi! No, this is the place to discuss it because if we wish to make games, work with existing platforms, and want speed, that is the way to go. Now that we have had this discussion, and found solutions, now we have a list of ways to resolve it. This is the place to discuss all of this and brings to the front the issues of speed, connections, and over all solutions. The only way to make Pygame better, faster and competitive with the world... Just like the question I had with the tts, text to speech, even though I do not use the video end yet, I do use the sound end. So Ian and speed is a very good question and take a look at what came of it below. I learn by doing, examples help because I get to use, tweak, and eventually like many have done, come up with a better solution or firm conclusion. For I now understand adding options into my setup.py file or now I call it setup4tts.py or anything for any need... Bruce From: "Richard Jones" I think this is the wrong forum to be having this discussion :) Richard From: Jason Ward The way I speed up my python code is Ctypes. I just make a dll file in C or asm and then call it with Ctypes and presto. I have tons of speed at my fingertips. Just my 2 cents :) On Thu, Apr 17, 2008 at 2:21 PM, Greg Ewing <[EMAIL PROTECTED]> wrote: > René Dudfield wrote: > > > > 2. - asm optimizations. There seems to be > > > > almost no asm optimizations in CPython. > > > > That's a deliberate policy. One of the goals of CPython > is to be very portable and written in a very straightforward > way. Including special pieces of asm for particular > architectures isn't usually considered worth the > maintenance effort required. > Other, more portable, software has proved this to be somewhat wrong I think. Optional asm software is used in a lot of software today to good effect. Also this decision was made a while ago, and things have changed since then I think. - python now has unittests. So testing that the asm code works, and keeps working correctly is much easier. - x86 is now very common. Most mainstream server, and desktops use x86. So just targeting x86 gives you a lot more benefit now. - SIMD instructions are the fast ones... so you don't actually have to learn all that much to write fast asm - you only have to learn a subset of asm. You can get compilers to generate the first pass of the function, and then modify it. Of course writing the fastest possible asm still requires effort - but it is fairly easy for a novice to beat a compiler with SIMD code. - advanced compilers can generate asm, which can then be used by worse compilers. eg, the intel compiler, or vectorc compiler can be used to generate asm, and then be included into C code compiled by gcc. - libraries of fast, tested asm code are available. eg, from amd, intel and others. - python, and FOSS now has a much larger development community with more asm experts. > > > CPython could use faster threading > > primitives, and more selective releasing of the GIL. > > > > Everyone would love to get rid of the GIL as well, but > that's another Very Hard Problem about which there has > been much discussion, but little in the way of workable > ideas. > Yeah, not getting rid of the GIL entirely - but selectively releasing it. As an example, pygame releases the GIL around certain C functionality like pygame.transform.scale. Freebsd, and linux have also followed this method - adding more fine grained locking where it is worth it - and improving their threading primitives. I think there has been work already in fixing a lot of python threading issues in the last year - but there's lots more to do. I'm using python on 8 core machines for my work loads just fine today. > > A way to know how much memory is being used. > > Memory profiling is the most important way to optimize since memory > > is quite slow compared to the speed of the cpu. > > > > Yes, but amount of memory used doesn't necessarily > have anything to do with rate of memory accesses. > Locality of reference, so that things stay in the > cache, is more important. > If you are using 200 bytes for each int, then you can quickly process 50x less data than an int that takes up 4 bytes. If you have 1 gig of available memory, and say kjDict uses up half the memory as a normal dict, a normal dict would use up 2gigs, and your kjDict will use up 1gig. In this case the kjDict would be massively faster than a normal dict because of swapping. I think memory is one of the most important areas in optimising a program these days. So python should provide tools to help measure memory use(how much memory things use, and how things are allocating memory). > > > perhaps releasing > > a patch with a few selected asm optimizations might let the python > > developers realise how much faster python could be... > > > > Have you actually tried any of this? Measurement > would be needed to tell whether these things
Re: [pygame] Python and Speed
Hi Ian, I think what you are saying and I agree, is that when someone has fixed something by going back to C code, then why not make a module for that code. Thus all you do is insert the C code using a Python/Pygame module name... But slowing down is when it uses the Python interpreter, but why not the C interpreter? Or make Python code that uses that format, but runs under the C interpreter? After all, it is all about ease in writing, higher level language using the lower level code under just a different name for translation, but normal C code once interpreted or translated... Bruce Ian Mallett <[EMAIL PROTECTED]> wrote: > Are there any plans to improve Python's speed to > at least the level of C languages? This isn't really the best forum for asking such a question. I would recommend asking on the general Python mailing list / newsgroup ("comp.lang.python" on http://www.python.org/community/lists/). I think I speak for all Python developers when I say that we'd love for the language to run faster. And of course the large body of core CPython developers are aware of this. I've personally attended a sprint in Iceland during which we spent a week solely focused on speeding up the CPython interpreter. There's just not much that can be done with the current CPython implementation to make it faster. Thus it falls to you as a developer to choose your implementation strategy wisely: 1. pick sensible libraries that handle large amounts of processing for you (whether that be numeric or graphic) 2. where there is no existing library, you may need to code speed-critical parts of your application using C, or the more programmer-friendly Pyrex (er, Cython these days I believe :) Richard -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.23.0/1381 - Release Date: 4/16/2008 9:34 AM
Re: [pygame] TTS and VISTA?
> pyTTS works on Vista. It just has a different selection of voices. > gb Note: if you install the SAPI5VoiceInstaller to get additional voices, it will break Vista's pyTTS system. -Doug Yes, that is what I think is Ian's problem. So the recommended fix is to do the voice install and select - uninstall. I guess that is the only way to do it. As what I could see as the fix for SAPI not supported, by getting rid of that voice install... Bruce > FT wrote: >> Hi, >> >> Since Microsoft has deliberately destroyed the use of the TTS >> engines in >> VISTA, does anyone know if someone is going to make a TTS version for >> VISTA? >> >> Bruce >> > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.13/1375 - Release Date: 4/12/2008 11:32 AM
Re: [pygame] TTS and VISTA?
Hi Gary, Ian, can not get TTS to work. I do not know what is wrong with his VISTA, but his keeps coming up with an error, "SAPI Not Supported" I did ask to have him uninstall any older versions by going the install and selecting uninstall as the the only way around the problem for when reading the Microsoft stuff and errors that is all I found in how to fix his problem. So, someone has to help Ian and what is going wrong with his computer. Bruce pyTTS works on Vista. It just has a different selection of voices. gb FT wrote: > Hi, > > Since Microsoft has deliberately destroyed the use of the TTS engines in > VISTA, does anyone know if someone is going to make a TTS version for VISTA? > > Bruce > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.13/1375 - Release Date: 4/12/2008 11:32 AM
[pygame] TTS and VISTA?
Hi, Since Microsoft has deliberately destroyed the use of the TTS engines in VISTA, does anyone know if someone is going to make a TTS version for VISTA? Bruce
Re: [pygame] Does PyGame support Ogg Vorbis "OOTB"?
Hi Ian, Thanks, I downloaded it and saving some of my wav files as ogg. I wanted something that allowed me to easily convert all those huge wav files into something transportable and small. Prior to you sending this I had found one other converter but not friendly to screen readers. This one does at least have a file menu, not just buttons on the screen that can only be reached by mouse clicks. So I have what I need to convert my Battle Ship game to .ogg files. The game does do the game with 2 players or computer to play against. I have a level one and 2 for the computer and a third which will be hard to beat in a few hours. Then you will be able to select levels, but not yet. Nice sound and voice for anyone to play, but no video, at least not in the near future. Bruce I love Audacity!
Re: [pygame] Does PyGame support Ogg Vorbis "OOTB"?
Hi! I had asked before but centered it on recording and was given the page for the mixer but no record features. The burning onto CD is resolved and works fine but do we have a way to translate wav to OGG? I would like to know if someone has written a module to convert formats into other formats? I have not gone to the tutorial page mentioned below yet, but would like to know since OGG files are much smaller then wav files. Bruce Subject: Re: [pygame] Does PyGame support Ogg Vorbis "OOTB"? I've written a tutorial on sound with pygame. You can find it at http://takira.freehosting.net/ Feel free to extend it or whatever. Also at the same page you can find the PyMP program which aims to play sound files the pygame way. It should be useful. Now for the *.ogg files, they sure are playable in Linux and Windows. Good luck with your tutorial. Takis Be a better friend, newshound, and know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.22.1/1348 - Release Date: 3/28/2008 10:58 AM
Re: [pygame] vista testing...
Hi Doug, Of course, I forgot! How stupid, just one of those UNIX things that when never using that stuff any more, you forget. I should have known, but when half asleep when writing it and testing it, it is easy to forget. It had been months since I had an issue of using control chars and such. Makes complete sense now. Now I have to clean up my game and get the help menu score card stuff up in a F key and fix the computer look-ahead turn and such. It works fine as is for playing with just the toggle back and forth. Bruce Bruce, It looks like you are mixing Windows paths (backslash) with Python strings. "\awe" means something different from "\\awe". Python strings are pretty smart in figuring out what you mean, but can't do it in all cases. \a means, I think, "ring the bell"; \n is newline, etc. I think if you use a single forward slash, or double backslash you'll be ok. -Doug FT wrote: > Hi Lenard > > your not going to believe this after extensive testing, what was needed > was the import os.path for that file and only that file would not play > without the path. > > I am not joking about this, for I tested all the files inside the data > folder from the folder above and all would work but the Awes file. But when > placing that file in the same directory as the .py file it worked. So I > decided to insert the os.path.join() into the file name for the mixer and it > worked. It runs now without any problem. > > So, the question to ask is why only that file? No other file inside the > data folder had an error and I have all sizes and shapes being run in my > battleship program. All them on the list have the "data\name" filename > inside the .mixer assignment. But only the awes file would say mixer load > error of no src, for it could not find the file. > > Talk about weird situations. So your test below failed until I added the > os.path command. I inserted it into my battle.py game and it works now. > Later I will do the assignments inside a method. > > The game is attached with the awe file inside the boohoo name. I guess > you could use your own files for sound unless I send it zipped up. > > Bruce > > Without calling pygame.mixer.pre_init the mixer defaults to a 22050 > sample rate and a 3072 byte buffer. The following test program played > the attached wave file with problem. > > > import pygame > > pygame.init() > > sound = pygame.mixer.Sound("Awes.wav") > sound.play() > > while pygame.mixer.get_busy(): > pass > > > Lenard > > > FT wrote: >> Hi! >> I am not sure if this is related because I do not get any scratching > on >> my sounds when I only use pygame.init with no mixer init but the attached >> file, the only one of the bunch I have will not play at all. In fact it > says >> error, no src. Also it says it is a null file. >> It is an 8 bit, 88K but I have many like this one but they play with > no >> problems or scratching. I use both 8 bit and 16 bit and one is played >> continuously, but this one dies once assigned with the null, no src error. >> >> So, what is the difference in this file from all others when trying to >> play it with the mixer? You have to convert it back to a .wav file for the >> list rejected with the extension on it, so I sent it without it. >> >> I am using pygame 1.8 rc 3 and SDL (1,2,12) >> >> Bruce >> >> >> When you say "that didn't work at all", what exactly do you mean? What >> SDL prebuilts were you running with what pygame when you had a >> problem? >> >> In terms of not working - do you mean you get a python exception? seg >> fault? stuff seemed to work but no sound played? >> >> Also, while I haven't tried an older SDL with pygame 1.8. I've >> successfully used the newer SDL dll's with pygame 1.7. >> >> So if the problems you had were trying to run the SDL from 1.7 with >> pygame 1.8, then maybe you can try pygame 1.7.1 with the newer SDL >> dll's here: >> http://www3.telus.net/len_l/prebuilt-msvcr71.zip >> the result of that one test case will provide useful info on if this >> is an SDL bug or not. >> >> >> On Mon, Mar 24, 2008 at 4:05 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: >> >>> Did try that yesterday but that didn't work at all. >>> I don't think the different versions of the mixer are >>> compatible. >>> >>> Brian Fisher skrev: >>> >>> >>> >>>> One other thing to try would be to swap out different SDL l
Re: [pygame] vista testing...
Hi Lenard your not going to believe this after extensive testing, what was needed was the import os.path for that file and only that file would not play without the path. I am not joking about this, for I tested all the files inside the data folder from the folder above and all would work but the Awes file. But when placing that file in the same directory as the .py file it worked. So I decided to insert the os.path.join() into the file name for the mixer and it worked. It runs now without any problem. So, the question to ask is why only that file? No other file inside the data folder had an error and I have all sizes and shapes being run in my battleship program. All them on the list have the "data\name" filename inside the .mixer assignment. But only the awes file would say mixer load error of no src, for it could not find the file. Talk about weird situations. So your test below failed until I added the os.path command. I inserted it into my battle.py game and it works now. Later I will do the assignments inside a method. The game is attached with the awe file inside the boohoo name. I guess you could use your own files for sound unless I send it zipped up. Bruce Without calling pygame.mixer.pre_init the mixer defaults to a 22050 sample rate and a 3072 byte buffer. The following test program played the attached wave file with problem. import pygame pygame.init() sound = pygame.mixer.Sound("Awes.wav") sound.play() while pygame.mixer.get_busy(): pass Lenard FT wrote: > Hi! > I am not sure if this is related because I do not get any scratching on > my sounds when I only use pygame.init with no mixer init but the attached > file, the only one of the bunch I have will not play at all. In fact it says > error, no src. Also it says it is a null file. > It is an 8 bit, 88K but I have many like this one but they play with no > problems or scratching. I use both 8 bit and 16 bit and one is played > continuously, but this one dies once assigned with the null, no src error. > > So, what is the difference in this file from all others when trying to > play it with the mixer? You have to convert it back to a .wav file for the > list rejected with the extension on it, so I sent it without it. > > I am using pygame 1.8 rc 3 and SDL (1,2,12) > > Bruce > > > When you say "that didn't work at all", what exactly do you mean? What > SDL prebuilts were you running with what pygame when you had a > problem? > > In terms of not working - do you mean you get a python exception? seg > fault? stuff seemed to work but no sound played? > > Also, while I haven't tried an older SDL with pygame 1.8. I've > successfully used the newer SDL dll's with pygame 1.7. > > So if the problems you had were trying to run the SDL from 1.7 with > pygame 1.8, then maybe you can try pygame 1.7.1 with the newer SDL > dll's here: > http://www3.telus.net/len_l/prebuilt-msvcr71.zip > the result of that one test case will provide useful info on if this > is an SDL bug or not. > > > On Mon, Mar 24, 2008 at 4:05 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > >> Did try that yesterday but that didn't work at all. >> I don't think the different versions of the mixer are >> compatible. >> >> Brian Fisher skrev: >> >> >> >>> One other thing to try would be to swap out different SDL library >>> >> > versions. Pygame 1.8 includes newer SDL library versions than 1.7 >> > does, I think SDL mixer was updated as part of that. >> > >> > You should be able switch being using the dll's for 1.7 here: >> > http://pygame.org/ftp/win32-dependencies.zip >> > >> > and the dll's for 1.8 here: >> > http://www3.telus.net/len_l/prebuilt-msvcr71.zip >> > >> > just by copying the dll's over the ones in your site-packages/pygame >> > dir. > >> > >> > so if you get scratchiness in both pygame 1.7 & 1.8 with the newer SDL >> > but not with the older SDL, it would seem to be a new SDL bug. if you >> > get scratchiness in pygame 1.8 with either SDL, but not in pygame 1.7 >> > with either SDL, then it would seem to be something pygame introduced. >> > >> > >> > On Mon, Mar 24, 2008 at 2:20 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: >> > >> >> Just tried it, no differens I am afraid. One thing I noticed , and >> > that > >> >> was true for >> >> the mingw version too, was that at 44k the music was running >> >> considerally slower. >> >> Not sure if th
Re: [pygame] vista testing...
Hi! I am not sure if this is related because I do not get any scratching on my sounds when I only use pygame.init with no mixer init but the attached file, the only one of the bunch I have will not play at all. In fact it says error, no src. Also it says it is a null file. It is an 8 bit, 88K but I have many like this one but they play with no problems or scratching. I use both 8 bit and 16 bit and one is played continuously, but this one dies once assigned with the null, no src error. So, what is the difference in this file from all others when trying to play it with the mixer? You have to convert it back to a .wav file for the list rejected with the extension on it, so I sent it without it. I am using pygame 1.8 rc 3 and SDL (1,2,12) Bruce When you say "that didn't work at all", what exactly do you mean? What SDL prebuilts were you running with what pygame when you had a problem? In terms of not working - do you mean you get a python exception? seg fault? stuff seemed to work but no sound played? Also, while I haven't tried an older SDL with pygame 1.8. I've successfully used the newer SDL dll's with pygame 1.7. So if the problems you had were trying to run the SDL from 1.7 with pygame 1.8, then maybe you can try pygame 1.7.1 with the newer SDL dll's here: http://www3.telus.net/len_l/prebuilt-msvcr71.zip the result of that one test case will provide useful info on if this is an SDL bug or not. On Mon, Mar 24, 2008 at 4:05 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > Did try that yesterday but that didn't work at all. > I don't think the different versions of the mixer are > compatible. > > Brian Fisher skrev: > > > > One other thing to try would be to swap out different SDL library > > versions. Pygame 1.8 includes newer SDL library versions than 1.7 > > does, I think SDL mixer was updated as part of that. > > > > You should be able switch being using the dll's for 1.7 here: > > http://pygame.org/ftp/win32-dependencies.zip > > > > and the dll's for 1.8 here: > > http://www3.telus.net/len_l/prebuilt-msvcr71.zip > > > > just by copying the dll's over the ones in your site-packages/pygame dir. > > > > so if you get scratchiness in both pygame 1.7 & 1.8 with the newer SDL > > but not with the older SDL, it would seem to be a new SDL bug. if you > > get scratchiness in pygame 1.8 with either SDL, but not in pygame 1.7 > > with either SDL, then it would seem to be something pygame introduced. > > > > > > On Mon, Mar 24, 2008 at 2:20 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > > > >> Just tried it, no differens I am afraid. One thing I noticed , and that > >> was true for > >> the mingw version too, was that at 44k the music was running > >> considerally slower. > >> Not sure if that's any clue. > >> Is the interrrupt not frequent enough for it to pump out the music ? Or > >> what do > >> think is happening here. Do you have any compiler options to play around > >> with ? > >> > >> René Dudfield skrev: > >> > >> > >> > >>> Are you able to try the pygame from here ? > >>> > >> > http://thorbrian.com/pygame/builds.php > >> > > >> > I think this is compiled with visual C rather than mingw, so maybe > >> > it'll be different... > >> > > >> > cheers, > >> > > >> > On Mon, Mar 24, 2008 at 11:21 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > >> > > >> >> The scratching are with all music files I have tested. The music have a > >> >> native sample rate > >> >> of 44k so there should be no need to resample, and it does work when the > >> >> output is changed > >> >> to 22k. I have tested with 15 different pieces. Furthermore it worked ok > >> >> in pygame 1.7. > >> >> > >> >> If I start a bit into the music I get occasional scratching for the rest > >> >> of the piece after that. > >> >> > >> >> Brian Fisher skrev: > >> >> > >> >> > >> >> > >> >>> The change with sample rate makes me think it may actually have to do > >> >>> > >> >> > with the particular sound samples as well? I understand that SDL is > >> >> > somewhat limited on the sample rate conversions it supports - got > >> >> > particular sounds files that sound scratchy you can send to test with? > >> >> > > >> >> > also, when you say you get scratches after starting some way into the > >> >> > music - do you mean you get like a pop when first playing the music, > >> >> > or do you mean that you get scratches throughout the music after you > >> >> > start it playing at a point in the sound? > >> >> > > >> >> > > >> >> > On Sun, Mar 23, 2008 at 2:27 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > >> >> > > >> >> >> The buffer setting doesn't seem to make a differens. > >> >> >> The key seem to be the sampling rate. Lots of scratching at 44k sound > >> >> >> but OK at 22k. But even then I get scratches if I start some way into > >> >> >> the music > >> >> >> rather then a
Re: [pygame] vista testing...
Hi! It will send the music out slower if you have increased the buffer size. Not at a slwoer speed entirely, just starting the music slower, more of a pause before starting. Bruce Just tried it, no differens I am afraid. One thing I noticed , and that was true for the mingw version too, was that at 44k the music was running considerally slower. Not sure if that's any clue. Is the interrrupt not frequent enough for it to pump out the music ? Or what do think is happening here. Do you have any compiler options to play around with ? René Dudfield skrev: > Are you able to try the pygame from here ? > http://thorbrian.com/pygame/builds.php > > I think this is compiled with visual C rather than mingw, so maybe > it'll be different... > > cheers, > > On Mon, Mar 24, 2008 at 11:21 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > >> The scratching are with all music files I have tested. The music have a >> native sample rate >> of 44k so there should be no need to resample, and it does work when the >> output is changed >> to 22k. I have tested with 15 different pieces. Furthermore it worked ok >> in pygame 1.7. >> >> If I start a bit into the music I get occasional scratching for the rest >> of the piece after that. >> >> Brian Fisher skrev: >> >> >> >>> The change with sample rate makes me think it may actually have to do >>> >> > with the particular sound samples as well? I understand that SDL is >> > somewhat limited on the sample rate conversions it supports - got >> > particular sounds files that sound scratchy you can send to test with? >> > >> > also, when you say you get scratches after starting some way into the >> > music - do you mean you get like a pop when first playing the music, >> > or do you mean that you get scratches throughout the music after you >> > start it playing at a point in the sound? >> > >> > >> > On Sun, Mar 23, 2008 at 2:27 PM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: >> > >> >> The buffer setting doesn't seem to make a differens. >> >> The key seem to be the sampling rate. Lots of scratching at 44k sound >> >> but OK at 22k. But even then I get scratches if I start some way into >> >> the music >> >> rather then at the start. The later problem I had in pygame 1.7 too. >> >> >> >> In pygame 1.7 music worked OK in Vista at 44k. >> >> I have tried both ogg and mp3 in pygame 1.8. >> >> Have you tried playing music at 44k on XP machines? Maybe this is a more >> >> general problem. >> >> >> >> Another thing that seem to have changed is that if a path to a sound file >> >> is wrong it doesn't cause an exception. Instead it returns an empty >> >> sound object.. >> >> Is that really intended ? >> >> >> >> >> > >> > >> >> >> > > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.8/1340 - Release Date: 3/23/2008 6:50 PM
Re: [pygame] vista testing...
Hi! I think there was also an issue of pre-init for any init would wipe out any settings. So the pre-init was setup to prevent the loss of any settings besides the size of the buffer to hold the data. The issue comes up all the time and is in the specs on the mixer and sound. Where it recommends increasing the buffer size and warns about the init of pygame and any mixer settings. Bruce Did you get scratchy sound playback with the same application on the same computer but pygame 1.7? does it make a difference if you set the SDL_AUDIODRIVER environment string to waveout ? On Sat, Mar 22, 2008 at 6:37 AM, Bo Jangeborg <[EMAIL PROTECTED]> wrote: > I have just tried the RC5 build from > http://www3.telus.net/len_l/pygame.htm . > Graphicly everything seem to work well so far but the music output > sounds really awful. Very scratchy sound. > I am running on python 2.5 , Windows Vista, and the machine is > an Intel core 2 cpu 6700 2.66 Ghz. Soundcard is a Soundblaster X-Fi. > > My standard setting is pygame.mixer.pre_init(44100, -16, 2, 2048) > Been trying different setting but it does not sound good, default settings > was a bit better but still very scratchy. Any ideas ? > > Regards > Bo Jangeborg > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.8/1338 - Release Date: 3/21/2008 5:52 PM
Re: [pygame] vista testing...
Hi! Did you try 4096 instead of 2048? It is a problem as the specs say. It is what is in cash verses load speed to get the sound started... I have just tried the RC5 build from http://www3.telus.net/len_l/pygame.htm . Graphicly everything seem to work well so far but the music output sounds really awful. Very scratchy sound. I am running on python 2.5 , Windows Vista, and the machine is an Intel core 2 cpu 6700 2.66 Ghz. Soundcard is a Soundblaster X-Fi. My standard setting is pygame.mixer.pre_init(44100, -16, 2, 2048) Been trying different setting but it does not sound good, default settings was a bit better but still very scratchy. Any ideas ? Regards Bo Jangeborg René Dudfield skrev: > Nice one :) > > I guess I'll do an RC5 release tonight... (+3 till 5 hours from now). > > Hopefully that'll be the last one. > > > On Mon, Mar 17, 2008 at 3:02 PM, Brian Fisher <[EMAIL PROTECTED]> wrote: > >> OK, pygame building is more friendly to msi's now (rc is now called b >> for beta when building msi's) >> >> my automated builds now have an msi for py2.5: >> http://thorbrian.com/pygame/builds.php >> seems to work fine on vista >> >> >> >> >> On Sun, Mar 16, 2008 at 3:44 PM, René Dudfield <[EMAIL PROTECTED]> wrote: >> > Nice one. >> > >> > Yeah, I think uninstall gets broken on vista with the .exe ones. I >> > haven't tried it, but that's what it seems to be trying to do - >> > install a registry key so it can uninstall it later. >> > >> > >> > >> > >> > On Mon, Mar 17, 2008 at 9:25 AM, Brian Fisher <[EMAIL PROTECTED]> wrote: >> > > yeah, msi seems the way to go. I think it's also better for 64-bit >> > > windows. The original wininst developer posted in a thread that he >> > > thinks it had a good life, and is fine with it being replaced by >> > > bdist_msi. >> > > >> > > I just installed vista recently, and I've been working today on making >> > > my automated builds use msi. >> > > >> > > ... but for what it's worth, the vista install errors with the .exe >> > > installers are generally fine to ignore, they don't affect pygame's >> > > functionality in any way I've been able to tell. >> > > >> > > >> > > >> > > On Sun, Mar 16, 2008 at 2:37 PM, René Dudfield <[EMAIL PROTECTED]> wrote: >> > > > Hi, >> > > > >> > > > I've tried to add a manifest with mt.exe but have not been able to get >> > > > it to work. It kept creating an executable with only 60KB size. >> > > > >> > > > I think the manifest needs a bunch of tweaking. >> > > > >> > > > However then I started reading up about blue screens caused by the >> > > > manifests on windows XP... >> > > > >> > > > So, let's use the msi build instead? Python uses a msi build anyway, >> > > > so the requirement is there already. The msi build installs ok on >> > > > vista, and asks for permission. >> > > > >> > > > I guess the only issue with that is the version string renaming, >> > > > because the msi doesn't like our version strings. I think that could >> > > > be fixed with someway to tell the installer to use a different naming >> > > > scheme. Or I guess we could ditch our old naming scheme, and change >> > > > it a little. But for this 1.8 release I think we should just stick >> > > > with the current naming, and change it for after pygame 1.8. >> > > > >> > > > cheers, >> > > > >> > > > >> > > > >> > > > >> > > > On Sun, Feb 17, 2008 at 6:40 AM, Brian Fisher <[EMAIL PROTECTED]> wrote: >> > > > > I couldn't find mt.exe in the platform SDK or .NET SDK's I've got >> > > > > installed - but I found it bundled with Visual Studio 2005. >> > > > > >> > > > > so I posted it here: >> > > > > thorbrian.com/mt.zip >> > > > > >> > > > > I think the usage to change a manifest is: >> > > > > mt -manifest -outputresource: >> > > > > >> > > > > and the usage to extract a manifest is: >> > > > > mt.exe -inputresource: -out: >> > > > > >> > > > > attached is a manifest I've used at work for installer-type-programs >> > > > > >> > > > > ... as a side note it looks like there is no manifest for the >> > > > > installer bdist_wininst makes for me, and without setup or installer >> > > > > in the name windows probably isn't auto-detecting and triggering it's >> > > > > "treat as an installer" behavior, so I'm kind of surprised it isn't >> > > > > virtualizing the environment for the installer and letting it think it >> > > > > has full access... >> > > > > >> > > > > >> > > > > >> > > > > >> > > > > On Feb 15, 2008 9:18 PM, Brian Fisher <[EMAIL PROTECTED]> wrote: >> > > > > > There's an command line mt.exe tool by microsoft that does it - I >> > > > > > think it comes with either the .NET or the Platform SDK, but I'm not >> > > > > > sure. You just create an xml manifest file with the righ
Re: [pygame] Pygame 1.8.0rc5 Windows installers available
Hi Marcus, Yes, so many different types, easy to get them confused. But, I am busy using that which is there, the sound and key events. It is working OK at the moment and I may even make up my own library of phonetic sounds for words to make the games even more user understandable. It is too early for me to get a full understanding of what can be done. Writing and expanding is the way I learn. Each method used when needed and such. Bruce On, Wed Mar 19, 2008, FT wrote: > > Hi, > > Marcus was going to work on the version to allow text and such for > buttons to be read and all other stuff much easier to use. I let him take > his time so he could at least get it done. The MSAA is that part of windows > that allows a blind user to get into the methods and such, like the text > inside the button and colors... [...] Bruce, I think you are confusing OcempGUI with pygame here :-). The first is the one that shall receive a11y features over time, pygame just should stay being the low-level fancy graphics, audio, etc. wrapper. Regards Marcus
Re: [pygame] Pygame 1.8.0rc5 Windows installers available
Hi Marcus, I know, I am busy with doing what I have to work with. Besides, what I am doing will keep me busy until you have something. Then, with what I have written, I can then use what you have made up for me. As with all stuff, it is hard to find a complete knowledge base for all stuff, especially windows as we all know... Thanks Marcus, I am busy learning and making games with the tts with help from Gary and others. Bruce I do not see any sense in adding a11y features directly to the pygame objects. As I already promised to Bruce, I'm working on an generic a11y python module, that allows arbitrary python object to be made accessible. Due to the incredible lack of valuable documentation on MSAA however, this will take quite some time. The unix backend is nearly fully operational however using the ATK/AT-SPI technologies to provide a11y information to the AT soft- and hardware. Bruce, I hope to have something you can work with available in some months or so, but for now I'm still messing around with how to incorporate the MSAA IAccessible2 interfaces and classes in Python code :-/. Regards Marcus
Re: [pygame] Pygame 1.8.0rc5 Windows installers available
Hi! I had asked Marcus a few months ago, as I had responded before yours came in. The MSAA is like Linux's Emac speak and such. The screen reader is built into most Linux now, not in widnows. I will let Marcus take a look at it and maybe explain it to you when he gets a chance to understand what is going on. At the moment I am able to use the tts for sound along with home-made wav files. It would be nice to be able to use all the tts engines at will and choice, but to get the commands and docs is part of the problem. I finished a version of Battleship, the old game used with a 9X9 grid to find and destroy enemy ships. I have not added the computer version, just 2 player at the moment. So the only part of pygame I use is the key event and sound events. Bruce There are no plans to do any accessibility features for pygame, that I am aware of. Given that pygame doesn't actually provide any specific features to help developers with buttons or other UI elements, it's not clear to me what pygame should or could do to make such things more accessible. If you have specific ideas for accessibility features, feel free to share them. If there was a developer who could serve as a mentor, accessibility features could possibly be a google summer of code project. On Tue, Mar 18, 2008 at 3:57 PM, FT <[EMAIL PROTECTED]> wrote: > > Hi! > > When will the MSAA or handicapped, blind, accessible version be looked > at? To allow easy access to the buttons and such? > > Bruce > > From: "Brian Fisher" <[EMAIL PROTECTED]> > Sent: Tuesday, March 18, 2008 4:50 PM > > > > > They are official release candidates, meaning we think they could be > an official release, but are not sure they are bug and problem free. > If they are found to be problem free, they will become the official > release. If people want to help that process, please install and test > these. > > On Tue, Mar 18, 2008 at 2:40 PM, Ian Mallett <[EMAIL PROTECTED]> wrote : > > When are these pre-releases going to become "official"? > > Ian > > > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.519 / Virus Database: 269.21.7/1333 - Release Date: 3/18/2008 8:10 AM
Re: [pygame] Pygame 1.8.0rc5 Windows installers available
Hi, Marcus was going to work on the version to allow text and such for buttons to be read and all other stuff much easier to use. I let him take his time so he could at least get it done. The MSAA is that part of windows that allows a blind user to get into the methods and such, like the text inside the button and colors... Linux already has that but the windows version does not until Marcus gets the time to work on it. He was given the screen reader web site to download a sample version to try and understand what is being looked at by a screen reader program. The NVDA web site I have not tried to see if there's works with pygame, but I can not even get a chance to join there development, they ignore my requests for the docs and such... there screen reader is object only and does not bother with colors yet, I guess to allow cross-platform compatibility. Bruce You would have to look at the MSAA and the definition, Micro Soft Access... What? On Wed, Mar 19, 2008 at 9:57 AM, FT <[EMAIL PROTECTED]> wrote: > > Hi! > > When will the MSAA or handicapped, blind, accessible version be looked > at? To allow easy access to the buttons and such? > > Bruce > > From: "Brian Fisher" <[EMAIL PROTECTED]> > Sent: Tuesday, March 18, 2008 4:50 PM > > > > > They are official release candidates, meaning we think they could be > an official release, but are not sure they are bug and problem free. > If they are found to be problem free, they will become the official > release. If people want to help that process, please install and test > these. > > On Tue, Mar 18, 2008 at 2:40 PM, Ian Mallett <[EMAIL PROTECTED]> wrote: > > When are these pre-releases going to become "official"? > > Ian > > >
Re: [pygame] Pygame 1.8.0rc5 Windows installers available
Hi! When will the MSAA or handicapped, blind, accessible version be looked at? To allow easy access to the buttons and such? Bruce From: "Brian Fisher" <[EMAIL PROTECTED]> Sent: Tuesday, March 18, 2008 4:50 PM They are official release candidates, meaning we think they could be an official release, but are not sure they are bug and problem free. If they are found to be problem free, they will become the official release. If people want to help that process, please install and test these. On Tue, Mar 18, 2008 at 2:40 PM, Ian Mallett <[EMAIL PROTECTED]> wrote: > When are these pre-releases going to become "official"? > Ian
Re: [pygame] py2exe problems
Ian, This error sounds like a wrong revision level or change in the data type structure, usually related to revision levels. So probably it was not compiled correctly or just the wrong revision level. Ian Sent: C:\dev\Python25\Projects\Pygame Programs\Parabola\4\dist>Parabola4.exe Traceback (most recent call last): File "Parabola 4.py", line 1, in File "pygame\__init__.pyc", line 159, in File "pygame\surfarray.pyc", line 68, in File "pygame\_numericsurfarray.pyc", line 12, in File "pygame\_numericsurfarray.pyc", line 10, in __load File "Numeric.pyc", line 93, in File "Precision.pyc", line 26, in File "Precision.pyc", line 23, in _fill_table File "Precision.pyc", line 18, in _get_precisions TypeError: data type not understood
Re: [pygame] py2exe problems
Run it at the DOS prompt or command line New problem. My program (which only uses pygame) doesn't run when py2exe'd. It says something about not being able to find the surfarray module when the .exe is run, but it closes almost instantly, so I can't really tell. I upgraded to pygame 1.8, if that makes a difference. Ian
Re: [pygame] TTS and Pitch Parameter
"Gary BIshop" <[EMAIL PROTECTED]> Wrote: I repeat, pyTTS, at least the version 3.0 that I have, does not have a method or property named Pitch. You are, I think simply assigned those values to an instance variable that you are adding to the tts object. Do you hear the pitch change when you assign to the pitch variable? Gary, I do not know why I thought there was a pitch command. I did a test just in python and could not get it to work. Do not know what or where I was when I thought there was a pitch command. so, could not duplicate it. Below is the modifications to the maze game you could test and run. I left the pitch in there but it is just an instance, and does not affect anything. I changed, modified the game for volume and rate. I also give it voices to change and also a good bye message. Bruce # Pyramid Puzzles # A Maze Exploration Game # By Shane Dittmar And Gary Bishop # Version 1.0 # use the arrow keys to play. Up arrow moves you forward. Left arrow turns 90 degrees left. # Right arrow turns 90 degrees right. Down arrow turns around 180 degrees. Escape quits. # # Listen for the hint in the sound of the wind. # Load Modules import pygame from pygame.locals import * import random, sys import time import math import pyTTS tts = pyTTS.Create() tts.Volume = 70 tts.Pitch = 1 # go to the program directory import os mydir = os.path.dirname(sys.argv[0]) if mydir: os.chdir(mydir) # Constants -- cell marks BOTTOMWALL = 0 RIGHTWALL = 1 VISITED= 2 PATH = 3 # Directions. I have numbered them so adding 1 rotates right and subtracting one rotates left NORTH = 0 SOUTH = 2 WEST = 3 EAST = 1 class Maze: def __init__( self, n_rows, n_cols ): """Create a maze with given number of rows and cols. member variable longest_path is the sequence of cells you pass through to get to the end. """ self.n_rows = n_rows self.n_cols = n_cols self.maze = [ [ [True,True,False,tuple()] for c in range(n_cols) ] for r in range(n_rows) ] self.longest_path = tuple() # will be the longest path through the maze def randomize( self ): # Choose a random end point currCol = random.randrange(self.n_cols) currRow = random.randrange(self.n_rows) # The search can be quite deep if self.n_rows*self.n_cols > sys.getrecursionlimit(): sys.setrecursionlimit( self.n_rows*self.n_cols+5 ) # Recursively Remove Walls - Depth First Algorithm self._make_path( currRow, currCol, tuple() ) #* def _make_path( self, R, C, path, D=None ): '''Used internally to generate the maze.''' maze = self.maze # speed up a bit maze[R][C][PATH] = path # track the longest path path = ((R,C),) + path if len(path) > len(self.longest_path): self.longest_path = path # Knock out wall between this and previous cell maze[R][C][VISITED] = True; if D==NORTH: maze[R] [C] [BOTTOMWALL] = False elif D==SOUTH: maze[R-1][C] [BOTTOMWALL] = False elif D==WEST: maze[R] [C] [RIGHTWALL] = False elif D==EAST: maze[R] [C-1][RIGHTWALL] = False # Build legal directions array directions = [] if R>0: directions.append(NORTH) if R0: directions.append(WEST) if C len(self.longest_path): self.longest_path = path # note that we've been here maze[R][C][VISITED] = True; # Build directions array directions = [] if R>0 and not maze[R-1][C][BOTTOMWALL]: directions.append(NORTH) if R0 and not maze[R][C-1][RIGHTWALL]: directions.append(WEST) if C 0: return SOUTH, distance if dc > 0: return EAST, distance if dc < 0: return WEST, distance def openings(self, row, col): '''For each direction indicate if there is an opening''' result = [False]*4 result[NORTH] = row>0 and not self.maze[row-1][col][BOTTOMWALL] result[SOUTH] = not self.maze[row][col][BOTTOMWALL] result[EAST] = not self.maze[row][col][RIGHTWALL] result[WEST] = col>0 and not self.maze[row][col-1][RIGHTWALL] return result def __str__(self): """Return a simple visual representation of the maze in ASCII""" if self.longest_path: result = str((self.longest_path[0],self.longest_path[-1]))+'\n' else: result = '((-1,-1),(-1,-1))\n' result += '.' + self.n_cols*'_.' result += '\n' for i in range(self.n_rows): result += '|' for j in range(self.n_cols): if i==self.n_rows-1 or self.maze[i][j][BOTTOMWALL]: result += '_' else: result += ' ' if j==self.n_cols-1 or self.maze[i][j][RIGHTWALL]: result += '|
Re: [pygame] TTS and Pitch Parameter
Brian, I sent a test below that does use the Pitch attribute and it does work. Now when adding pygame import, init pygame, then at the end pygame quit, it still works for the pitch, but an error saying python has encountered a problem comes up and exits the program after you click on the option for the error report. This error only happens at the end of doing all the speaking of the test below. Now I can show the example programs to you and maybe you can test it and see what is going on. I will send that in the next file. Now I was doing tests in pygame using a mixer and the main loop. Now when inserting tts.Volume, and tts.Rate they both work. But when adding tts.Pitch it dies at the tts.Pitch assignment, or making of an instance. The error at that point is the object tts has no attribute Pitch. But that error does not show in the example below. I'm afraid I don't understand - so the script you emailed works fine for you in python 2.5 on your windows box, right? So then what exactly doesn't work? I still don't get why you think pygame is involved... On Fri, Mar 7, 2008 at 3:45 PM, FT <[EMAIL PROTECTED]> wrote: > Below is the speech.py file which will load in python25 from my windows > OS. It uses the same command as in the pygame example, no different. So, the > same import should be in affect, except if pygame uses these same commands, > the pitch does not work. > import pyTTS > import time > tts = pyTTS.Create() > > # set the speech rate, higher value = faster > # just for fun try values of -10 to 10 > tts.Rate = 3 > print "Speech rate =", tts.Rate > > #NOW SET THE PITCH! > tts.Pitch = 3 > print "Speech pitch =", tts.Pitch > > # set the speech volume percentage (0-100%) > tts.Volume = 90 > print "Speech volume =", tts.Volume > > tts.SetVoiceByName('MSSam') > print "Voice is now set to Sam!" > tts.Speak("The speech rate is: ") > tts.Speak(tts.Rate) > tts.Speak("The speech pitch is: ") > tts.Speak(tts.Pitch) > tts.Speak("The speech volume is:") > tts.Speak(tts.Volume) > print > > # get a list of all the available voices > tts.Speak("The List Of Voices Are: ") > tts.Speak(tts.GetVoiceNames()) > print "List of voices =", tts.GetVoiceNames() > > # explicitly set a voice > tts.SetVoiceByName('MSMary') > print "Voice is set to Mary" > print > # announce the date and time, does a good job > timeStr = "The date and time is " + time.asctime() > print timeStr > tts.Speak(timeStr) > print > > str1 = """ > A young executive was leaving the office at 6 pm when he found > the CEO standing in front of a shredder with a piece of paper in hand. > "Listen," said the CEO, "this is important, and my secretary has left. > Can you make this thing work?" > "Certainly," said the young executive. He turned the machine on, > inserted the paper, and pressed the start button. > "Excellent, excellent!" said the CEO as his paper disappeared inside > the machine. "I just need one copy." > """ > print str1 > tts.Speak(str1) > tts.Speak('Haah haa, haah, haa!') > print > > tts.SetVoiceByName('MSMike') > tts.Speak("Now we are using Mike's voice!") > > str2 = """ > Finagle's fourth law: > Once a job is fouled up, anything done to improve it only makes it worse. > """ > print str2 > print > print "The spoken text above has been written to a wave file (.wav)" > tts.Speak("Now sending text to a wav file!") > tts.SpeakToWave('Finagle4.wav', str2) > print "The wave file is loaded back and spoken ..." > tts.Speak("Now speaking the wav file: ") > tts.SpeakFromWave('Finagle4.wav') > print > > print "Substitute a hard to pronounce word like Ctrl key ..." > #create an instance of the pronunciation corrector > p = pyTTS.Pronounce() > # replace words that are hard to pronounce with something that > # is spelled out or misspelled, but at least sounds like it > p.AddMisspelled('Ctrl', 'Control') > str3 = p.Correct('Please press the Ctrl key!') > tts.Speak(str3) > print > > print "2 * 3 = 6" > tts.Speak('2 * 3 = 6') > print > tts.Speak("sounds goofy, let's replace * with times") > print "Substitute * with times" > # ' * ' needs the spaces > p.AddMisspelled(' * ', 'times') > str4 = p.Correct('2 * 3 = 6') > tts.Speak(str4) > print > > print "Say that real fast a few times!" > str5 = "The sinking steamer sunk!" > tts.Rate = 6 > for k in range(4): > print str5 > tts.Speak(str5) > time.sleep(0.2) > tts.Rate = 0 > > tts.Pitch = 1 > tts.SetVoiceByName("MSSam") > tts.Speak("Wow, not one mispronounced word!") > > -- No virus found in this incoming message. Checked by AVG. Version: 7.5.518 / Virus Database: 269.21.6/1318 - Release Date: 3/7/2008 2:01 PM
Re: [pygame] TTS and Pitch Parameter
Hi! Below is the speech.py file which will load in python25 from my windows OS. It uses the same command as in the pygame example, no different. So, the same import should be in affect, except if pygame uses these same commands, the pitch does not work. import pyTTS import time tts = pyTTS.Create() # set the speech rate, higher value = faster # just for fun try values of -10 to 10 tts.Rate = 3 print "Speech rate =", tts.Rate #NOW SET THE PITCH! tts.Pitch = 3 print "Speech pitch =", tts.Pitch # set the speech volume percentage (0-100%) tts.Volume = 90 print "Speech volume =", tts.Volume tts.SetVoiceByName('MSSam') print "Voice is now set to Sam!" tts.Speak("The speech rate is: ") tts.Speak(tts.Rate) tts.Speak("The speech pitch is: ") tts.Speak(tts.Pitch) tts.Speak("The speech volume is:") tts.Speak(tts.Volume) print # get a list of all the available voices tts.Speak("The List Of Voices Are: ") tts.Speak(tts.GetVoiceNames()) print "List of voices =", tts.GetVoiceNames() # explicitly set a voice tts.SetVoiceByName('MSMary') print "Voice is set to Mary" print # announce the date and time, does a good job timeStr = "The date and time is " + time.asctime() print timeStr tts.Speak(timeStr) print str1 = """ A young executive was leaving the office at 6 pm when he found the CEO standing in front of a shredder with a piece of paper in hand. "Listen," said the CEO, "this is important, and my secretary has left. Can you make this thing work?" "Certainly," said the young executive. He turned the machine on, inserted the paper, and pressed the start button. "Excellent, excellent!" said the CEO as his paper disappeared inside the machine. "I just need one copy." """ print str1 tts.Speak(str1) tts.Speak('Haah haa, haah, haa!') print tts.SetVoiceByName('MSMike') tts.Speak("Now we are using Mike's voice!") str2 = """ Finagle's fourth law: Once a job is fouled up, anything done to improve it only makes it worse. """ print str2 print print "The spoken text above has been written to a wave file (.wav)" tts.Speak("Now sending text to a wav file!") tts.SpeakToWave('Finagle4.wav', str2) print "The wave file is loaded back and spoken ..." tts.Speak("Now speaking the wav file: ") tts.SpeakFromWave('Finagle4.wav') print print "Substitute a hard to pronounce word like Ctrl key ..." #create an instance of the pronunciation corrector p = pyTTS.Pronounce() # replace words that are hard to pronounce with something that # is spelled out or misspelled, but at least sounds like it p.AddMisspelled('Ctrl', 'Control') str3 = p.Correct('Please press the Ctrl key!') tts.Speak(str3) print print "2 * 3 = 6" tts.Speak('2 * 3 = 6') print tts.Speak("sounds goofy, let's replace * with times") print "Substitute * with times" # ' * ' needs the spaces p.AddMisspelled(' * ', 'times') str4 = p.Correct('2 * 3 = 6') tts.Speak(str4) print print "Say that real fast a few times!" str5 = "The sinking steamer sunk!" tts.Rate = 6 for k in range(4): print str5 tts.Speak(str5) time.sleep(0.2) tts.Rate = 0 tts.Pitch = 1 tts.SetVoiceByName("MSSam") tts.Speak("Wow, not one mispronounced word!")
Re: [pygame] TTS and Pitch Parameter
Brian, I know pygame has no text to speech, but the python25 I have does not have the error. It would appear to be how pygame was made. For the pyTTS module is brought in but something in pygame must be interfering with it. For the module is the same, something else must be there. Or a different revision level...Mixer??? Bruce Brian Fisher Wrote: pygame doesn't have any text-to-speech features. I don't think pygame is related to the problem. I think it's a red herring. On Fri, Mar 7, 2008 at 11:31 AM, FT <[EMAIL PROTECTED]> wrote: > > When running a python25 game I get the tts.Rate and tts.Pitch to work > fine. But when using pygame the tts.Pitch is not there, is there a reason > why? Is it because of the wrong version used to make pygame? > > I am using pygame 1.8.0 rc3 and it just says that this parameter is not > a part of this synth > > > Bruce
[pygame] TTS and Pitch Parameter
When running a python25 game I get the tts.Rate and tts.Pitch to work fine. But when using pygame the tts.Pitch is not there, is there a reason why? Is it because of the wrong version used to make pygame? I am using pygame 1.8.0 rc3 and it just says that this parameter is not a part of this synth Bruce
Re: [pygame] CD Burning Of Games?
Thanks, I want to make copies that are not on a hard drive to have a backup storage. Give it to some friends getting into programming, and family... Bruce This does audio in pygame programs: http://www.pygame.org/docs/ref/cdrom.html If you just want to distribute, can just burn programs onto a cd. I assume you mean having your program make cds, though?
[pygame] CD Burning Of Games?
Was there ever a project to write CD/DVD Burning programs to save games? Bruce
Re: [pygame] space ships (Re: Misnamed threads (Re: Posting styles (Re: Text To Speech PYTTS)))
What ever happened to a list talking about game writing and code? Besides, the ship in the garage was, "My Favorite Martian!" Any other would be copy right infringement, a stolen idea. Ha! Ha! Also Rod Serling wrote about the "Will The Real Martian Stand Up?" where footsteps came out of a pond to a restaurant door. Five people got off a bus and went into the same restaurant. A police oficer came to the area to investigate a UFO landing in a pond and noticed the footsteps going to the door of the restaurant. The officer went inside the restaurant to tried to find out who was the Martian. At the end the Martian boasted to another man that he was the Martian. Only to be talking to a Venusian. The Martian said he was sending ships to take over earth and the Venusian said, "I know, our ships have intercepted them, and we are now going to take over the Earth!" So, when will we start talking about code, I like when a list is a list for Py_Games, and not talk. Also, a spaceship stays in space, the shuttle is a shuttle, and can not be anything but a shuttle... Bruce OK then, I like spacecraft too. Lenard Ian Mallett wrote: > hmmm. > I would not define the space shuttle as a space ship because it > requires an external fuel tank and two extra rockets to get into > space. In fact, all of NASA's creations, then have not been rockets > because they cannot travel to and from space without incredible > difficulty and sacrifice of parts. -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.3/1308 - Release Date: 3/3/2008 10:01 AM
Re: [pygame] Text To Speech PYTTS
Yes Laura, my very point! Since some do it at the bottom as noted, it is a pain to read all the way down. The bottom is only for first time readers. It also depends on how someone receives there mail and reads first to last or last to first, if organized by date, or date and subject. Bruce - Original Message - From: "Laura Creighton" <[EMAIL PROTECTED]> Sent: Sunday, March 02, 2008 3:25 PM Subject: Re: [pygame] Text To Speech PYTTS On the other hand, if you have been following the discussion, a rule requiring top posting can be greatly beneficial, especially when combined with a rule that you cannot go 'ding ding ding' and respond to each line of a prior message, as if this were a code review, but instead have to summarise, and more importantly, only address the main points. New people to the discussion will, of course suffer, but people who have been following the discussion will immediately know when they can go on to the next message, and not read reams of gorp they already know and have already seen 5 times looking to see if there is 'anything new' there. It saves a _ton_ of time.
[pygame] Proper Posting Format
From: "Joe Johnston" <[EMAIL PROTECTED]> Sent: Sunday, March 02, 2008 9:22 AM Subject: Re: [pygame] Text To Speech PYTTS Luke Paireepinart wrote: > So you read "lane fire" instead of "fire lane". Joe Johnston Wrote: I think top-posting is useful in those places where the correspondants stubbornly refuse to edit *any* of the previous responses, so you end up with huge swathes of wasted text... I guess it is OK for sighted users, where the reading, scanning down the screen is easy. I also try to delete the old, but not always. I do it to make the point immediately then anyone reading under it will see why, but those who have not read previous postings can get lost quick. I also do it first is because with a screen reader program you read one line at a time, not a screen at a time. It is time consuming to go down the page and read it all, especially since it is another response to the existing. But from now on, as in this one, I will snip the others and place the answer at the bottom. Yet there will be some that do the opposite, so reading one line at a time can be a little painful, time consuming. Thanks for the thoughts. Bruce
[pygame] Other Engines
Gary, NVDA uses a large choice of engines and wondering if you have looked at it? Gives you choices on what to use. Bruce
Re: [pygame] Text To Speech PYTTS
Ian, I am not sure if there is a tts for Vista, but the Vista has gone to SAPI5.3 and the voices are not the same. I am sure the commands are not the same but where is the error? It probably will not support SAPI 5.1 even though they say it will. You probably have to look up in the tts for Vista when doing a search on the Internet. >>> import pyTTS >>> tts = pyTTS.Create() Traceback (most recent call last): File "", line 1, in tts = pyTTS.Create() File "C:\dev\Python25\Lib\site-packages\pyTTS\__init__.py", line 28, in Create raise ValueError('"%s" not supported' % api) ValueError: "SAPI" not supported
Re: [pygame] Text To Speech PYTTS
Hi Gary, Yes, that is probably his problem. It is advertised everywhere, kind of the usual Microsoft joke. Also, I found the web page that had all your hints on getting things to work. After all the no help at the Microsoft site and such I did do the voice install you recommended once I found the page it was on. http://wwwx.cs.unc.edu/~gb/wp/research/hark-the-sound/install-instructions/ Now with my XP Pro I do have the 3 voices. I tested it and they do now work and are on the list of names using the getname command. print "List of voices =", tts.GetVoiceNames() Thanks, and good luck Ian Bruce Sorry to hear you run Vista. That is probably the root of the problem. I have made pyTTS work on Vista back when I had a VM running it but I don't now. I recommend you upgrade to XP. Lots of vendors are offering XP upgrade coupons for people who bought Vista. gb Ian Mallett wrote: > Vista Home Premium >
Re: [pygame] Text To Speech PYTTS
Did you do the Vista version on that page? same error...
Re: [pygame] Text To Speech PYTTS
Hi Ian, I do not know if Gary gave you this but try it: http://wwwx.cs.unc.edu/~gb/wp/research/hark-the-sound/install-instructions/ - Original Message - From: Ian Mallett To: pygame-users@seul.org Sent: Saturday, March 01, 2008 1:28 AM Subject: Re: [pygame] Text To Speech PYTTS Which one? I downloaded and installed the 2.0MB one, but it said the same thing... No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.2/1304 - Release Date: 2/29/2008 8:18 AM
Re: [pygame] Text To Speech PYTTS
Gary, I did down load the packages and the Mary and Mike, but it does not recognize them, only Sam is in the speech box on the Control Panel. I search on the Internet and the sad thing is that others had the same problem and it says you have to re-load XP to get those voice connected. Unless there is something on the XP disk for repair or add. But if there is an add feature let me know. Bruce You need the additional voices. XP comes with only MSSam. You can get Mary and Mike here: http://www.cs.unc.edu/Research/assist/Hark3/SAPI5VoiceInstaller.msi gb FT wrote: > Hi! > > No, for an error will come up if you use the 4 version for Python 2.5 so > it will not work. > > But, having loaded the SAPI5 I can not access the Mary and Mike voices, > even though I used the SAPI installer. So something is going on or they are > not being installed. > > Mine does work but only with the Sam voice. Some how they have to be > loaded into the Control panel for speech and how is that done? > > For that is the only conclusion if all other things are there and > installed. For the problem you're having seems to be the same but on a > different level. FOr I am given no choice on what speech to install unless > that is done directly from the Windows disk... > > Bruce > > > Ian, > > What operating system are you using? > > gb > > Ian Mallett wrote: >> I did that and it still doesn't work. Must I use >> pyTTS-3.0.win32-py2.4.exe-- I have Python >> 2.5 >> > > > -- > No virus found in this incoming message. > Checked by AVG Free Edition. > Version: 7.5.516 / Virus Database: 269.21.2/1305 - Release Date: 2/29/2008 > 6:32 PM > > -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.2/1305 - Release Date: 2/29/2008 6:32 PM
Re: [pygame] Text To Speech PYTTS
Hi! Yes I could but since the question was about all 3 items I re-sent it with all 3 instead of one at a time. But the problem seems to be more involved, I mean the issue with SAPI. I have noticed that some people place the response under the original but I will try and keep things more organnized, like below. Bruce - Original Message - From: "Luke Paireepinart" <[EMAIL PROTECTED]> To: Sent: Saturday, March 01, 2008 4:00 AM Subject: Re: [pygame] Text To Speech PYTTS FT wrote: > Try Looking Here: > > # download installer file pyTTS-3.0.win32-py2.4.exe > # from: http://sourceforge.net/projects/uncassist > # also needs: > http://www.cs.unc.edu/Research/assist/packages/SAPI5SpeechInstaller.msi > > # and pywin32-204.win32-py2.4.exe at this date the latest version of > win32com > # from: > > http://sourceforge.net/projects/pywin32/ > Hey FT, can you use the standard method of replying where it keeps the new message separate from the body of the old one? Your messages are very hard to read without it.
Re: [pygame] Text To Speech PYTTS
Hi! No, for an error will come up if you use the 4 version for Python 2.5 so it will not work. But, having loaded the SAPI5 I can not access the Mary and Mike voices, even though I used the SAPI installer. So something is going on or they are not being installed. Mine does work but only with the Sam voice. Some how they have to be loaded into the Control panel for speech and how is that done? For that is the only conclusion if all other things are there and installed. For the problem you're having seems to be the same but on a different level. FOr I am given no choice on what speech to install unless that is done directly from the Windows disk... Bruce Ian, What operating system are you using? gb Ian Mallett wrote: > I did that and it still doesn't work. Must I use > pyTTS-3.0.win32-py2.4.exe-- I have Python > 2.5 > -- No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.2/1305 - Release Date: 2/29/2008 6:32 PM
Re: [pygame] Text To Speech PYTTS
Subject: Re: [pygame] Text To Speech PYTTS Which one? I downloaded and installed the 2.0MB one, but it said the same thing... Sample: http://www.daniweb.com/code/snippet326.html Try Looking Here: # download installer file pyTTS-3.0.win32-py2.4.exe # from: http://sourceforge.net/projects/uncassist # also needs: http://www.cs.unc.edu/Research/assist/packages/SAPI5SpeechInstaller.msi # and pywin32-204.win32-py2.4.exe at this date the latest version of win32com # from: http://sourceforge.net/projects/pywin32/
Re: [pygame] Text To Speech PYTTS
Subject: Re: [pygame] Text To Speech PYTTS Which one? I downloaded and installed the 2.0MB one, but it said the same thing... Try Looking Here: # download installer file pyTTS-3.0.win32-py2.4.exe # from: http://sourceforge.net/projects/uncassist # also needs: http://www.cs.unc.edu/Research/assist/packages/SAPI5SpeechInstaller.msi # and pywin32-204.win32-py2.4.exe at this date the latest version of win32com # from: http://sourceforge.net/projects/pywin32/
Re: [pygame] Text To Speech PYTTS
Download what is needed for your error: http://www.microsoft.com/downloads/details.aspx?familyid=5E86EC97-40A7-453F-B0EE-6583171B4530&displaylang=en >>> import pyTTS >>> tts = pyTTS.Create() Traceback (most recent call last): File "", line 1, in tts = pyTTS.Create() File "C:\dev\Python25\Lib\site-packages\pyTTS\__init__.py", line 28, in Create raise ValueError('"%s" not supported' % api) ValueError: "SAPI" not supported >>> No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.2/1304 - Release Date: 2/29/2008 8:18 AM
Re: [pygame] Text To Speech PYTTS
I am not sure what your error would be except that you may not have the recent speech for windows installed. There are certain things to download at the web site, 3 things total. But I did not download anything but the PYTTS and it worked on my Windows XP Pro platform. so take a look and see if you have the other 2 they ask you to get. Bruce - Original Message - From: Ian Mallett To: pygame-users@seul.org Sent: Friday, February 29, 2008 1:18 PM Subject: Re: [pygame] Text To Speech PYTTS >>> import pyTTS >>> tts = pyTTS.Create() Traceback (most recent call last): File "", line 1, in tts = pyTTS.Create() File "C:\dev\Python25\Lib\site-packages\pyTTS\__init__.py", line 28, in Create raise ValueError('"%s" not supported' % api) ValueError: "SAPI" not supported
Re: [pygame] Text To Speech PYTTS
Hi! Below is a nice demo game using the text to speech. It is a maze game using it. I guess anything can go from here. From: "kschnee" <[EMAIL PROTECTED]> Sent: Friday, February 29, 2008 11:22 AM Subject: Re: [pygame] Text To Speech PYTTS On Fri, 29 Feb 2008 11:16:26 -0500, "FT" <[EMAIL PROTECTED]> wrote: > > To get text to speech software, or PYTTS, this is the download page for > the Text To Speech engine. > > North Carolina Assistive Technology Downloads: > http://sourceforge.net/project/showfiles.php?group_id=65529#downloads What features does it have? I also note that there's a program called PyFlite, which is a version of the Festival speech synth program developed at CMU. The game to play using the text to speech: # use the arrow keys to play. Up arrow moves you forward. Left arrow turns 90 degrees left. # Right arrow turns 90 degrees right. Down arrow turns around 180 degrees. Escape quits. # # Listen for the hint in the sound of the wind. # Load Modules import pygame import random, sys import time import math import pyTTS tts = pyTTS.Create() # go to the program directory import os mydir = os.path.dirname(sys.argv[0]) if mydir: os.chdir(mydir) # Constants -- cell marks BOTTOMWALL = 0 RIGHTWALL = 1 VISITED= 2 PATH = 3 # Directions. I have numbered them so adding 1 rotates right and subtracting one rotates left NORTH = 0 SOUTH = 2 WEST = 3 EAST = 1 class Maze: def __init__( self, n_rows, n_cols ): """Create a maze with given number of rows and cols. member variable longest_path is the sequence of cells you pass through to get to the end. """ self.n_rows = n_rows self.n_cols = n_cols self.maze = [ [ [True,True,False,tuple()] for c in range(n_cols) ] for r in range(n_rows) ] self.longest_path = tuple() # will be the longest path through the maze def randomize( self ): # Choose a random end point currCol = random.randrange(self.n_cols) currRow = random.randrange(self.n_rows) # The search can be quite deep if self.n_rows*self.n_cols > sys.getrecursionlimit(): sys.setrecursionlimit( self.n_rows*self.n_cols+5 ) # Recursively Remove Walls - Depth First Algorithm self._make_path( currRow, currCol, tuple() ) #* def _make_path( self, R, C, path, D=None ): '''Used internally to generate the maze.''' maze = self.maze # speed up a bit maze[R][C][PATH] = path # track the longest path path = ((R,C),) + path if len(path) > len(self.longest_path): self.longest_path = path # Knock out wall between this and previous cell maze[R][C][VISITED] = True; if D==NORTH: maze[R] [C] [BOTTOMWALL] = False elif D==SOUTH: maze[R-1][C] [BOTTOMWALL] = False elif D==WEST: maze[R] [C] [RIGHTWALL] = False elif D==EAST: maze[R] [C-1][RIGHTWALL] = False # Build legal directions array directions = [] if R>0: directions.append(NORTH) if R0: directions.append(WEST) if C len(self.longest_path): self.longest_path = path # note that we've been here maze[R][C][VISITED] = True; # Build directions array directions = [] if R>0 and not maze[R-1][C][BOTTOMWALL]: directions.append(NORTH) if R0 and not maze[R][C-1][RIGHTWALL]: directions.append(WEST) if C 0: return SOUTH, distance if dc > 0: return EAST, distance if dc < 0: return WEST, distance def openings(self, row, col): '''For each direction indicate if there is an opening''' result = [False]*4 result[NORTH] = row>0 and not self.maze[row-1][col][BOTTOMWALL] result[SOUTH] = not self.maze[row][col][BOTTOMWALL] result[EAST] = not self.maze[row][col][RIGHTWALL] result[WEST] = col>0 and not self.maze[row][col-1][RIGHTWALL] return result def __str__(self): """Return a simple visual representation of the maze in ASCII""" if self.longest_path: result = str((self.longest_path[0],self.longest_path[-1]))+'\n' else: result = '((-1,-1),(-1,-1))\n' result += '.' + self.n_cols*'_.' result += '\n' for i in range(self.n_rows): result += '|' for j in range(self.n_cols): if i==self.n_rows-1 or self.maze[i][j][BOTTOMWALL]: result += '_' else: result += ' ' if j==self.n_cols-1 or self.maze[i][j][RI
Re: [pygame] Text To Speech PYTTS
On Fri, 29 Feb 2008 11:16:26 -0500, "FT" <[EMAIL PROTECTED]> wrote: > > To get text to speech software, or PYTTS, this is the download page for > the Text To Speech engine. > > North Carolina Assistive Technology Downloads: > http://sourceforge.net/project/showfiles.php?group_id=65529#downloads What features does it have? I also note that there's a program called PyFlite, which is a version of the Festival speech synth program developed at CMU. The first link will take you right to it. The University of North Carolina wrote one. http://www.cs.unc.edu/Research/assist/doc/pytts/ http://epydoc.sf.net Table of Contents Table of Contents Everything Packages pyTTS Modules pyTTS.Pronounce pyTTS.sapi [ show private | hide private] Everything Everything All Classes pyTTS.Pronounce.Pronounce pyTTS.Pronounce.Translator pyTTS.sapi.Base pyTTS.sapi.SynthAndOutput pyTTS.sapi.SynthOnly pyTTS.sapi.VoiceEvent pyTTS.sapi.VoiceEventManager All Functions Create pyTTS All Variables tts_async tts_default tts_event_audio_level tts_event_bookmark tts_event_end_stream tts_event_engine_private tts_event_phoneme tts_event_sentence tts_event_start_stream tts_event_viseme tts_event_voice_change tts_event_word tts_is_filename tts_is_not_xml tts_is_xml tts_misspelled tts_nlp_speak_punc tts_persist_xml tts_phonetic tts_purge_before_speak [ show private | hide private] pyTTS Home Trees Index Help pyTTS Package pyTTS [ show private | hide private] [ frames | no frames ] Package pyTTS Submodules Pronounce : Defines classes that aid in pronunciation correction and the building of pronunciation dictionaries. sapi : Defines classes for using the Microsoft Speech API. Function Summary Create (api, output) Create a new instance of the named speech API. pyTTS (*args, **kwargs) Deprecated. Function Details Create(api='SAPI', output=True) Create a new instance of the named speech API. Parameters: api - Name of speech API (currently only SAPI) (type=string) output - Should synthesized speech be played? (type=boolean) pyTTS(*args, **kwargs) Deprecated. Use Create instead. Home Trees Index Help pyTTS Generated by Epydoc 2.1 on Fri Feb 18 13:59:27 2005 http://epydoc.sf.net
Re: [pygame] Text To Speech PYTTS
Hi! Below is a page of the tutorial that you will find at the web site. On Fri, 29 Feb 2008 11:16:26 -0500, "FT" <[EMAIL PROTECTED]> wrote: > > To get text to speech software, or PYTTS, this is the download page for > the Text To Speech engine. > > North Carolina Assistive Technology Downloads: > http://sourceforge.net/project/showfiles.php?group_id=65529#downloads What features does it have? I also note that there's a program called PyFlite, which is a version of the Festival speech synth program developed at CMU. Table of Contents Table of Contents Everything Packages pyTTS Modules pyTTS.Pronounce pyTTS.sapi [ show private | hide private] Everything Everything All Classes pyTTS.Pronounce.Pronounce pyTTS.Pronounce.Translator pyTTS.sapi.Base pyTTS.sapi.SynthAndOutput pyTTS.sapi.SynthOnly pyTTS.sapi.VoiceEvent pyTTS.sapi.VoiceEventManager All Functions Create pyTTS All Variables tts_async tts_default tts_event_audio_level tts_event_bookmark tts_event_end_stream tts_event_engine_private tts_event_phoneme tts_event_sentence tts_event_start_stream tts_event_viseme tts_event_voice_change tts_event_word tts_is_filename tts_is_not_xml tts_is_xml tts_misspelled tts_nlp_speak_punc tts_persist_xml tts_phonetic tts_purge_before_speak [ show private | hide private] pyTTS Home Trees Index Help pyTTS Package pyTTS [ show private | hide private] [ frames | no frames ] Package pyTTS Submodules Pronounce : Defines classes that aid in pronunciation correction and the building of pronunciation dictionaries. sapi : Defines classes for using the Microsoft Speech API. Function Summary Create (api, output) Create a new instance of the named speech API. pyTTS (*args, **kwargs) Deprecated. Function Details Create(api='SAPI', output=True) Create a new instance of the named speech API. Parameters: api - Name of speech API (currently only SAPI) (type=string) output - Should synthesized speech be played? (type=boolean) pyTTS(*args, **kwargs) Deprecated. Use Create instead. Home Trees Index Help pyTTS Generated by Epydoc 2.1 on Fri Feb 18 13:59:27 2005 http://epydoc.sf.net
[pygame] Text To Speech PYTTS
To get text to speech software, or PYTTS, this is the download page for the Text To Speech engine. North Carolina Assistive Technology Downloads: http://sourceforge.net/project/showfiles.php?group_id=65529#downloads
Re: [pygame] Sound to String
I was given NVDA weeks ago and you can download skeleton drivers but like most places they are very short on documentation. Below, at the bottom of this message is the response I got last night. I have not looked at it yet, but I am new at this and documentation is a must in order to see what they have done. So the links are below at the bottom and anyone who looks at the sources it would be a great help to develope such an engine. I understand that Linix and EMax Speak has gotten much better but I still use windows and would like to keep it that way for now. The NVDA project does have a speech/screen reader for windows, but it is only object oriented and does not use the screen, just the objects. So anything spoken with color only is lost. Which prevents you from knowing such things as Read, Attachment, UnRead when looking at your Outlook Express mail. If anyone can look at the drivers and such with this project and give me some info on it would be a great help. When talking with the project person he told me he had to learn it on his own, so he was not going to give me any help. In other words, do it myself, but "Open Source?" Bruce - Original Message - From: "Laura Creighton" <[EMAIL PROTECTED]> Sent: Thursday, February 28, 2008 5:38 AM Subject: Re: [pygame] Sound to String In a message of Thu, 28 Feb 2008 04:25:53 CST, Luke Paireepinart writes: >Ian Mallett wrote: >> You could always record the sound you want to play, but actually >> rendering sound from text might be difficult. If anyone knows, I'd >> like to know too. >Rendering sound is a pretty common operation called Text-to-Speech. I'm >sure you could find an open-source C library for this and wrap it with >ctypes. If there isn't one, someone needs to start one immediately. >If anyone takes up wrapping this, let me know, cause I'm interested >too. Also, if you don't know how to wrap it but you find a suitable >library let me know as well. >Also it's quite possible there's already a Python library for TTS. >I haven't done any research into TTS in about 5 years. The University of North Carolina wrote one. http://www.cs.unc.edu/Research/assist/doc/pytts/ Laura On 28 Feb, FT <[EMAIL PROTECTED]> wrote: > I am a new programmer and using python to learn how to make my own > games and such with a built in text to speech. > I read that you wrote it in C and python is a higher level of C and > easier to use then C. I hope you can help or give me the tools or > where to get the tools/drivers to connect the speech to the sound > card. Unfortunately I have not used Python and I don't know anything about it. I know that the NVDA screen-reader project: http://www.nvda-project.org uses Python to use eSpeak, so you can probably find some information and examples there. There are two ways to use eSpeak on Windows. NVDA uses both of these, as alternatives. 1. The eSpeak API. This uses eSpeak as a DLL. The eSpeak API is defined in file: speak_lib.h. A project file to make the eSpeak DLL is included in the directory platforms/windows/windows_dll in the eSpeak download. or 2. The Microsoft SAPI5 interface. This provides a common interface to different text-to-speech engines. Details are available in the Microsoft Speech Development Kit ("SDK") which you can download from the Microsoft website, http://www.microsoft.com/downloads/details.aspx?FamilyID=5e86ec97-40a7-453f- b0ee-6583171b4530&displaylang=en
Re: [pygame] Sound to String
Hi! I was also wondering along these lines if anyone knows who has the best text to speech documentation? I would like to learn how to use it, and write my own talking games. I am using the windows OS Bruce Subject: Re: [pygame] Sound to String You can use sndarray to change the sound into an array, then you can recompose the sound in your file. PyDay allows the use of modules in the construction, though not in the final product. In short, you can use Numeric to create the data, but you will have to reencode it yourself. No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.21.1/1301 - Release Date: 2/27/2008 8:35 AM
Re: [pygame] #pygame on irc.freenode.net
Hey! I would like to learn Pygame and watch the bugs and get solutions. Enough is enough, lets just talk about programming. There are hackers everywhere and those who feel good at others suffering and expense. The world is a mess, lets keep it clean, at least try here... Bruce If you say IRC is like that. Myself, well, #pygame is the only channel as bad as this that I visit. My only experience with crude IRC members is with spammers and #pygame. But, hey, it's IRC. In any case, if #pygame can get off because it's IRC, fine. It's Pygame's decision to moderate it, not mine or anybody else's. I'd much rather it be a proper channel, something more professional like the other channels I visit. Maybe it's just my selection of channels, but I've never had the troubles you say are rampant on IRC. I expected #pygame to be like the rest-- I guess you'd call that my first taste of 'the real IRC'? On 2/19/08, Noah Kantrowitz <[EMAIL PROTECTED]> wrote: > Lets can the euphemism please. You think some of the #pygame regulars > (most often piman) are offensive and crude. You are 100% correct. > Different forms of communication have different tones and cultures. This > mailing list, for example, is generally quite civil. IRC is a _much_ > more casual environment. If you dislike this environment, don't use it. > #pygame is not the public face of Pygame, and I don't think anyone wants > it to be. Speaking generally, you will also find that people on IRC will > warm up to you very fast once you demonstrate that you aren't some > random kid off the street who thinks he can make The Next Great Game > (tm). The internet is a dangerous place, tread lightly. > > --Noah > >
Re: [pygame] timing question
Yes, the Pygame event is exactly that and using the K_ codes for checks. I also added this other function as well which uses the windows version and is just a little more in the check using a dictionary list for inserting commands. This time inside I use a GG method variable to store the dictionary. That dictionary is the key-code first like the K_ command codes for the keyboard. It first checks to see if it is on the list with the IN command then places the equivalent command from the dictionary into the resulting return code you want. The 2 control codes for all keyboard command is either a 0 which is a null or a 224 code for most extended keyboard commands. In the other example I gave you are also printed the keycodes the keyboard has and can be commented out. But when pressing the key and getting the event triggered, you will get either a keycode, control code of 0 or 224 and just check for that. For in the extended keyboard keys there are 2 characters sent out from the keyboard. Where the first key is the 0 or 224 and a check must be done for that. If neither is present then it will send only one key back. I had a routine that checked for that then passed them into the routine below as 2 keys as present inside the keyboard buffer. But you would have to build your own or just do a test. So the routine below is passing in either a string of one char or a string of 2 chars based on the key pressed on the keyboard. Once that is observed then place your dictionary substitute into the result as I have done below. The dictionary has the format: {"O", "MRS"} and the "O" is the code for the End Of Line or EOL key on the extended keyboard. You can build your own list using all the key codes of the K_ list. So make any list you want and the rest is as he mentions below. The keyboard keydown event and call the method I suggested. Bruce def key2Com(GG, kbs): "CONVERT THE 0 AND 224 KEY CODES TO COMMANDS!" if len(kbs) < 2: return(kbs) if kbs[0] == chr(0): if kbs[1] == "O": kbs = "CMRS" elif kbs[1] == "Q": kbs = "CLRS" if kbs[0] == chr(224) and kbs[1] in GG.MKS224: kbs = GG.MKS224[ kbs[1]] return (kbs) - Original Message - From: "kschnee" <[EMAIL PROTECTED]> To: Sent: Tuesday, January 29, 2008 11:54 AM Subject: Re: [pygame] timing question On Tue, 29 Jan 2008 11:06:06 +0100, "Miguel Sicart" <[EMAIL PROTECTED]> wrote: > Hi all, > I'm writing a little text-based game and I have stumbled upon a strange > newbie problem. > In this game, the player has to input a number of commands in order to > interact with the game. I am using raw_input to get input from the player. > My problem is that I want to make it turn based, and I want to limit the > amount of time players have per turn. And I don't know how to do that. I > have tried to create an event and push it to the event list, but it > doesn't > act until the player provides input, so it is not working. Others are offering actual code, so I'll chime in with the theory: The "raw_input" function is a "blocking" function, meaning that it waits for input and prevents anything else from happening. Because of that, putting events onto the Pygame stack won't help because those events won't get checked until after the user hits Enter. What the others are saying is basically that instead of that function you can use a continuous loop that checks whether a key has been hit and if so, reacts to it, otherwise just going back into the loop. That's a "non-blocking" solution that lets you check the Pygame event queue to do things like looping music and checking a timer. In Pygame there's a slightly different way to do that, loosely like so: text_entered = "" for event in pygame.event.get(): if event.type == KEYDOWN: key = event.key ## Check for pressing of keys like Escape and Backspace. if key == K_ENTER: ## We're done. ## If the key is in the range of keys representing letters/numbers/space: text_entered += character ## where character is the appropriate letter etc. Kris
Re: [pygame] timing question
Hi Again, This is the example you want for what you are doing. Enjoy! Bruce # File: msvcrt-example-2.py import msvcrt import time print "press SPACE to enter the serial number" while not msvcrt.kbhit() or msvcrt.getch() != " ": # do something else while we're waiting print ".", time.sleep(0.1) print # clear the keyboard buffer while msvcrt.kbhit(): msvcrt.getch() serial = raw_input("enter your serial number: ") print "serial number is", serial c = raw_input( "Please Hit Enter To Continue __> ") - Original Message - From: Miguel Sicart To: pygame-users@seul.org Sent: Tuesday, January 29, 2008 5:06 AM Subject: [pygame] timing question Hi all, I'm writing a little text-based game and I have stumbled upon a strange newbie problem. In this game, the player has to input a number of commands in order to interact with the game. I am using raw_input to get input from the player. My problem is that I want to make it turn based, and I want to limit the amount of time players have per turn. And I don't know how to do that. I have tried to create an event and push it to the event list, but it doesn't act until the player provides input, so it is not working. So the idea is: player provides specific input (raw_input) game objects are affected by input +1 turn if turns = x: game over I am quite sure this is a simple problem, but I have been going around it for a couple of days with no success - help! :) thanks! mundial
Re: [pygame] timing question
You can use this input for your check. Inside the while statement place a keydown check and it should work. This is what I use for my game at the moment for single key strokes. I will send the while check in my second email to the list. Enjoy programming. Bruce import msvcrt #INPUT KEYBOARD COMMANDS! def key_Input(msg): "ENTER A KEY OR FUNCTION KEY, (ALT, CTRL, SHIFT...KEY)" # clear the keyboard buffer ch=""; ch1=""; sch="" while msvcrt.kbhit(): ch = msvcrt.getch() #PlaySound ("Federation_Scan.ogg", 2, -1) #PLAY ANY SOUND HERE! #print "| " #print "Hit Return Or Escape To Quit or Move Using Cursor Keys:" print msg, while ch != chr(27) and ch != chr(13) and ch1 != chr(0) and ch1 != chr(224): ch1 = msvcrt.getch() ch = ch1 if ch1 == chr(0) or ch1 == chr(224): ch = msvcrt.getch() sch = ch1+ch print; print "ch=%d ch1=%d" % (ord(ch), ord(ch1)) else: ch = ch.upper() if ch in "ABCDEFGHIJKLMNOPQRSTUVWXYZ": msvcrt.putch(ch) sch+=ch elif ch == chr(8) and len(sch)>0: msvcrt.putch(ch) sch = sch[:len(sch)-1] if ch == chr(27): i=len(sch) while i>0: i-=1 msvcrt.putch(chr(8)) sch="XXX" print sch print return (sch) def key2Com( kbs): "CONVERT THE 0 AND 224 KEY CODES TO COMMANDS!" if len(kbs) < 2: return(kbs) if kbs[0] == chr(0): if kbs[1] == "O": kbs = "CMRS" elif kbs[1] == "Q": kbs = "CLRS" if kbs[0] == chr(224) and kbs[1] in MK224: kbs = MK224[ kbs[1]] return (kbs) - Original Message - From: Miguel Sicart To: pygame-users@seul.org Sent: Tuesday, January 29, 2008 5:06 AM Subject: [pygame] timing question Hi all, I'm writing a little text-based game and I have stumbled upon a strange newbie problem. In this game, the player has to input a number of commands in order to interact with the game. I am using raw_input to get input from the player. My problem is that I want to make it turn based, and I want to limit the amount of time players have per turn. And I don't know how to do that. I have tried to create an event and push it to the event list, but it doesn't act until the player provides input, so it is not working. So the idea is: player provides specific input (raw_input) game objects are affected by input +1 turn if turns = x: game over I am quite sure this is a simple problem, but I have been going around it for a couple of days with no success - help! :) thanks! mundial
Re: [pygame] py2exe problems
Hi! Here is the skeleton file to use and the first 2 lines I use a batch file to insert those names. Where the first one is the game to compile and the second variable is the new name for the game and the executable file that will be made. My batch file just looks at what you placed on the command line for names and attaches them to the setup.py file and then the rest is run at the end of the batch file with the standard setup.py command line parameters preceded by your version of python. I guess there are many ways to change this skeleton for what usage you want it for. commenting out that which you do not need as I have done or add to the list what you need. It is the skeleton that is in the zip file. Bruce The setup.py File: PY_PROG = 'trek10.py' APP_NAME = 'Trek_Game' cfg = { 'name':APP_NAME, 'version':'1.0', 'description':'', 'author':'', 'author_email':'', 'url':'', 'py2exe.target':'', #'py2exe.icon':'icon.ico', #64x64 'py2exe.binary':APP_NAME, #leave off the .exe, it will be added 'py2app.target':'', 'py2app.icon':'icon.icns', #128x128 'cx_freeze.cmd':'~/src/cx_Freeze-3.0.3/FreezePython', 'cx_freeze.target':'', 'cx_freeze.binary':APP_NAME, } # usage: python setup.py command # # sdist - build a source dist # py2exe - build an exe # py2app - build an app # cx_freeze - build a linux binary (not implemented) # # the goods are placed in the dist dir for you to .zip up or whatever... from distutils.core import setup, Extension try: import py2exe except: pass import sys import glob import os import shutil try: cmd = sys.argv[1] except IndexError: print 'Usage: setup.py py2exe|py2app|cx_freeze' raise SystemExit # utility for adding subdirectories def add_files( dest, generator): for dirpath, dirnames, filenames in generator: for name in 'CVS', '.svn': if name in dirnames: dirnames.remove(name) for name in filenames: if '~' in name: continue suffix = os.path.splitext(name)[1] if suffix in ('.pyc', '.pyo'): continue if name[0] == '.': continue filename = os.path.join(dirpath, name) dest.append(filename) # define what is our data data = [] add_files( data, os.walk('data')) data.extend( glob.glob('*.txt')) # define what is our source src = [] add_files( src, os.walk('lib')) src.extend( glob.glob('*.py')) # build the sdist target if cmd == 'sdist': f = open( "MANIFEST.in", "w") for l in data: f.write("include "+l+"\n") for l in src: f.write("include "+l+"\n") f.close() setup( name=cfg['name'], version=cfg['version'], description=cfg['description'], author=cfg['author'], author_email=cfg['author_email'], url=cfg['url'], ) # build the py2exe target if cmd in ('py2exe',): dist_dir = os.path.join('dist',cfg['py2exe.target']) data_dir = dist_dir src = PY_PROG dest = cfg['py2exe.binary']+'.py' shutil.copy(src,dest) setup( options={'py2exe':{ 'dist_dir':dist_dir, 'dll_excludes':['_dotblas.pyd','_numpy.pyd'] }}, #windows=[{ console=[{ 'script':dest, #'icon_resources':[(1,cfg['py2exe.icon'])], }], ) # build the py2app target if cmd == 'py2app': dist_dir = os.path.join('dist',cfg['py2app.target']+'.app') data_dir = os.path.join(dist_dir,'Contents','Resources') from setuptools import setup src = PY_PROG dest = cfg['py2app.target']+'.py' shutil.copy(src,dest) APP = [dest] DATA_FILES = [] OPTIONS = {'argv_emulation': True, 'iconfile':cfg['py2app.icon']} setup( app=APP, data_files=DATA_FILES, options={'py2app': OPTIONS}, setup_requires=['py2app'], ) # make the cx_freeze target if cmd == 'cx_freeze': dist_dir = os.path.join('dist',cfg['cx_freeze.target']) data_dir = dist_dir os.system('%s --install-dir %s --target-name %s %s' % (cfg['cx_freeze.cmd'], cfg['cx_freeze.binary'], dist_dir, PY_PROG)) # recursively make a bunch of folders def make_dirs(dname_): parts = list(os.path.split(dname_)) dname = None while len(parts): if dname == None: dname = parts.pop(0) else: dname = os.path.join(dname,parts.pop(0)) if not os.path.isdir(dname): os.mkdir(dname) # copy data into the binaries if cmd in ('py2exe','cx_freeze','py2app'): dest = data_dir for fname in data: dname = os.path.join(dest,os.path.dirname(fname)) make_dirs(dname) if not os.path.isdir(fname): shutil.copy(fname,dname) - Original Message - From: "René Dudfield" <[EMAIL PROTECTED]> To: Sent: Monday, January 21, 2008 8:49 PM Subject: Re: [pygame] py2exe problems There is a way to tell py2exe to ignore modules. Try usi
Re: [pygame] Help: improve new module documentation. Read this, and give me comments.
Hi! A thought, I am sure you probably have tried it. But you mention the vector, and you know the direction, thus you can reduce the field of mask/test then check less pixels in the upcoming collision point(s). Just a thought, just requires that vector and how to write that vector. Knowing the image at start and it's direction, then only looking at that point and the look-ahead pixels of that point/area. Only a thought, yet have not read /looked at any code to know what you guys have done. Bruce Yeah I have generated my own masks in pure python for per pixel or special effects, and it is super slow. I have to precalculate all the masks or there is nothing doing. This module sounds great! The only point of confusion is the point of intersection. Very rarely is only one point intersecting. Which point exactly is the intersecting point? With rects you could say its the corner, or you could have a vector that determines how far out to move it, based on the center of the rect, so it's not intersecting etc, but with a mask there is no "corner", and likely not a "center" either. On Jan 22, 2008 1:55 PM, Ian Mallett <[EMAIL PROTECTED]> wrote: > Sorry, don't have time to give a good answer about the documentation, > but a pixel perfect collision detector is great! The one I wrote for > a game a while ago works, but is not to portable... > I >
Re: [pygame] New GUI
Hi Kamilche Being a blind user and the need for an all text version. It would be nice to have something that is complete text oriented. I have not tried any for the screen does not allow the screen reader to scan unless it is standard Window Classic with classic colors and standard buttons and menus. A text version that has menus that say the same things as fancy buttons and such do. The menus must be of the standard windows style as I mentioned. Search functions and such as a part of menus That is what is ideal for a blind user. Bruce I've looked at wxPython, PGU, Ocemp GUI, PyUI, and other GUI toolkits available for Python. Each of them had, to my eyes, severe flaws that prevented me from using them for my apps. Therefore, I've spent many months developing my own GUI and event system. The GUI has windowing, translucency, buttons, menus, slider bars, frames, and more. It has a drag n drop GUI builder. The controls can be 'anchored', meaning when you resize the window, the controls resize automatically as well. It has an easy event handling system similar to VB6, but also the capability for controls to handle 'global' events. I'm using it for a couple of commercial apps I'm making. I'm considering making the GUI itself available commercially, as well. I'm writing this email to gauge the level of interest in it. If you're interested, respond in this thread. Pricing is an unknown - if you have thoughts in that area, I'd appreciate hearing them. --Kamilche