This is my second try to send a message I wrote yesterday, alas I appended a *.wav file, which was not accepted by the mail system. Now here is a link to the file uses in the source: http://dl.dropbox.com/u/2016850/Bubo.wav ---- posting follows here: Hi, today was a bad day for me, very ineffective. With a lot of things I tried out I ran into troubles. For now I'll only give some feedback (and ask some questions) regarding pygame2. I tried to port the playSound.py to pygame2 (with Python 3.1) in order to find out if this works. I've appended my very uneducated try. What did I observe? (1) In the cases it works, id doesn't do as in the docs written: if one omits the loop parameter it loops forever (2) I was not able to play an *.ogg (3) If "someSound.ogg" is loaded, retrieving someSound.len lets the program crash (4) A try to play it, results in pygame2.Error: Tried to play a NULL chunk It seems to me that there is a certain lack of examples and ported games to pygame2. Perhaps because porting seems to be quite tedious. In the end I refused to port the label stuff in the playSound program :-( Morover I observed, that pixelarray.py crashed after the 4th mouseclick without saying why. I only was asked if I wanted a respective message to be sent to microsoft. I declined :-) So after a first impression pygame2 still seems to be rather immature. I think you should insert quite a few beta releases before releasing the first release candidate. DOES SOMEONE KNOW OF EXAMPLES OF WORKING GAMES WRITTEN WITHPYGAME2? I'd appreciate any pointers. More on problems with Python 3.1 and pygame 1.9.1 tomorrow (Here it's 2 o'clock in the morning now.) Regards, Gregor Marcus von Appen schrieb:
pgreloaded 2.0.0-alpha5 was released. pgreloaded (Pygame2) is an ongoing rewrite of the Pygame multimedia and game framework. As Pygame, its purpose is to make writing multimedia applications, such as games, with Python as easy as possible, while providing the developer a reliable and extensible programming interface. It features a modular and loosely coupled package and module layout and access to the most features of the libraries it wraps. pgreloaded can be installed side-by-side with Pygame as it uses a different package namespace and thus will not cause any conflicts with another Pygame installation. *** This is an alpha release for testing purposes and not meant to be run in production environments. *** This is the last alpha release for pgreloaded 2.0.0. No new features will be implemented now. Instead it is going into a testing period with several release candidates. TEST IT! :-) Dependencies ------------ * Python 2.4, 2.5, 2.6, 2.7 or 3.1 Optional: * SDL >= 1.2.10 * SDL_mixer >= 1.2.11 * SDL_ttf >= 2.0.9 * SDL_image >= 1.2.10 * SDL_gfx >= 2.0.18 * libpng >= 1.2.24 * libjpeg >= 6b * freetype >= 2.3.5 * portmidi >= 199 * OpenAL >= 1.1 (Aug 2009) or -soft >= 1.11.753 Features and changes in 2.0.0-alpha5 ------------------------------------ * SDL_ttf 2.0.10 feature support * sdl.Surface alpha blit routines support OpenMP now * math.Vector operations are more strict about the dimensions now. * Added support for __copy__ and __deepcopy__ operations to various core classes * Added Lorenz' large patch set for the math module * Added deprecation notices for legacy code to be changed * freetype.Font.render() argument order changes * Overhauled and simplified the unit testing framework * documentation improvements * various 64-bit platform fixes * the default installer releases for Win32 platforms are using MSVC++ now * Python 2.7 Download -------- The source and documentation packages as well as prebuilt Win32 installers are available from here: http://code.google.com/p/pgreloaded/downloads/list Regards Marcus
""" playSound.py demonstrates playing an ogg sound on demand """ import pygame2 import pygame2.sdl.constants as constants import pygame2.sdl.event as event import pygame2.sdl.video as video import pygame2.sdl.wm as wm import pygame2.sdlmixer as mixer ##pygame.init() ##pygame.mixer.init() def main(): video.init() mixer.init() mixer.open_audio(22050,8,2,2048) ch = mixer.Channel(0) #wm.init() screen = video.set_mode((640, 480)) wm.set_caption("play sound") ## #create background ## background = pygame.Surface(screen.get_size()) ## background = background.convert() ## background.fill((255, 255, 0)) ## ## #create label ## myFont = pygame.font.SysFont("Comic Sans MS", 30) ## label = myFont.render("Press SPACE to hear a sound", 1, (0, 0, 255)) ## ## #create sound someSound = mixer.Chunk("Bubo.wav") #someSound = mixer.Chunk("someSound.ogg") #print(someSound.len) keepGoing = True #clock = pygame.time.Clock() while keepGoing: #clock.tick() for ev in event.get(): if ev.type == constants.QUIT: keepGoing = False elif ev.type == constants.KEYDOWN: if ev.key == constants.K_SPACE: ch.play(someSound) ## elif event.key == pygame.K_ESCAPE: ## keepGoing = False screen.fill(pygame2.Color(255, 250, 0)) #screen.blit(label, (100, 100)) screen.flip() video.quit() if __name__ == "__main__": main()
Attachment:
someSound.ogg
Description: Binary data