Re: [pygame] MOD files question
Hi Will, >The docs for pygame.mixer.music mention MOD files. What kind of MOD >files can PyGame play? Does anyone still use them? I don't think I have >even seen any since MP3 took over! >Thanks, >Will McGugan I went to great effort a few weeks ago to get fmod (a commercial sound package) to play mod files with pygame, only to be told that pygame supports mod files, as you mentioned. So I tried a few different modules with pygame, including a standard ".mod" file, an ".IT" (Impulse Tracker) file, and ".XM" (extended module?) file and, if I remember correctly, an "S3M" (ScreamTracker) file. All the mod files I've ever played are in one of those formats, so pygame's module support is pretty good. Regarding whether people still use mod files, I used them in a Windows DirectX game because they were of much higher quality than any MIDI music I've heard. But the quality will really depend on the musical score. I've found some excellent mod files on the net. There are several web sites devoted to mod files, so mods are still popular. I have heard, however, that musicians who used to write music in mod format are now changing over to composing midi music. On another note (pun!), my linux box will not play mod files properly. First I had trouble with playing OGG files, but then someone told me I had to change the SDL sound settings. That fixed the OGG playback, but all the modules I play hiss, and I have changed every SDL sound setting but have had no luck; I still get hissing playback of all mods. Any ideas? Cheers, Andrew. _ Yahoo!7 Mail has just got even bigger and better with unlimited storage on all webmail accounts. http://au.docs.yahoo.com/mail/unlimitedstorage.html
Re: [pygame] music module bindings for python
Hi Greg and others, - Original Message From: Greg Ewing <[EMAIL PROTECTED]> To: pygame-users@seul.org Cc: [EMAIL PROTECTED] Sent: Thursday, 24 May, 2007 6:10:56 PM Subject: Re: [pygame] music module bindings for python René Dudfield wrote: > pygame has mod support through sdl_mixer. That's true. Note that you need to use pygame.mixer.music rather than a pygame.mixer.Sound object, though. I just tried the following on MacOSX and it worked: from time import sleep from pygame import mixer mixer.init() music = mixer.music music.load("bigjapan.mod") music.play() sleep(1) (The mod file I used is from http://www.df.lth.se/~fernbom/music/mods/files/bigjapan.zip). -- Greg Thanks for telling me about the mod support. I assumed that pygame didn't have mod support because I'd heard of PySonic, which led me on the wrong track. I have tested (with pygame's mixer) not only mods, but also more complex "mod" formats, including IT and XM. They all work, but I've had some trouble with playback. The worst problem is that of the music hissing. The same music plays perfectly with SoundTracker (on my Linux box) and also perfectly on Windows. I have experimented with the mixing speed and also the buffer size, but such changes make no difference. You may recall that I was the one with the "sound crackling" woes when I couldn't get Ogg files to play. Someone pointed me to SDL environment variables, and a line like: export SDLAUDIODRIVER=dsp did the trick: no more crackling. But I still get hiss with modules. Seems to be an OS problem. If anyone knows more detail about setting SDL variables, please tell me, as I'd like to get modules playing perfectly, if possible. The other problem is that I can't set the volume of the modules very high (100% is not very loud). Any ideas? Cheers, Andrew. _ How would you spend $50,000 to create a more sustainable environment in Australia? Go to Yahoo!7 Answers and share your idea. http://advision.webevents.yahoo.com/aunz/lifestyle/answers/y7ans-babp_reg.html
Re: [pygame] Mouse and Fullscreen
Hi John, - Original Message From: John Eriksson <[EMAIL PROTECTED]> To: pygame-users@seul.org Sent: Tuesday, 29 May, 2007 3:19:26 PM Subject: [pygame] Mouse and Fullscreen Hi, I'm having some troubles using the mouse pointer when setting the display to fullscreen. I have no problems on Linux but in Windows the mouse doesnät show up. (Maybe just some occasional flicker.) Is this known problem or am I doing something wrong. I'm trying to set the resolution to 800x600. Best Regards /John Before switching to Python, I was writing a Java SDL app, and encountered the same problem. I wrote code to display a custom mouse pointer, which worked in a Windows window but never in fullscreen mode. Actually, it did kind-of show, appearing once in a while right near the other cursor. So, I was getting a mix of two cursors. This was so annoying, especially since I went to the trouble of having a custom animated cursor. I checked out the docs on SDL website and found that other people had the same trouble. The author of SDL said that it's currently a bug and that it may be addressed in a future version of SDL. The problem, if I recall, is that SDL can only blit the cursor on one of the two page-flipped frames (the secondary one, never the primary). Although I'm new at Pygame, I think its graphics functionality is all SDL-based, so the effect you're getting doesn't surprise me. Maybe some Pygame guru can solve the problem, but if it's an underlying SDL problem, you're probably out of luck, as I was! Cheers, Andrew. How would you spend $50,000 to create a more sustainable environment in Australia? Go to Yahoo!7 Answers and share your idea. http://advision.webevents.yahoo.com/aunz/lifestyle/answers/y7ans-babp_reg.html
[pygame] music module bindings for python
Hi Greg and others, For the last few weeks I have been trying to get MODule format music to work with Python. I have found a fair bit of MODule playing code written in other languages, mostly c, c++, and assembler, but no code or bindings for Python, except PySonic. I have tried to get PySonic to work with my linux box, but I can't get it to work. I've heard that people have got it to work for linux, but I've had no luck. Greg wrote below: - Original Message From: Greg Ewing <[EMAIL PROTECTED]> It has a setup.py file, so you should be able to compile it with distutils instead of invoking gcc yourself. From the setup.py, on Unix systems it expects the fmod distribution to be in a subdirectory called "fmod" under the directory where the .pyx files etc are. Then you should just be able to say python setup.py install At least that's the way it looks like it's mean to work. I don't have a Linux system handy to try it on right now. If it can't find Python.h, check whether you have a directory called /usr/include/pythonX.Y (where X.Y is whatever Python version you're using) containing Python.h and the other .h files that it uses. If not, you may have to tracl down and install the appropriate "developer" package for Python (it will be called something like "python-X.Y-devel"). You shouldn't have to install the complete Python source. -- I have followed the advice above, but still got hundreds of compilation or linking errors. Sorry I'm not specific about the errors, but I don't have the technical expertise to get the installation working. I'm almost totally new to Python, and so I'm not up to extending and embedding with Pyrex, SWIG, etc. Has anyone got PySonic (and hence Fmod) to work under linux? Another MODule player I know of is called MikMod, which is Open Source, unlike FMod. I've searched the web for Python bindings to MikMod, and almost had success. Specifically, I searched for "mikmod binding for python". I got a result titled "Lateral Opinion: 13.10.2004". The page's links are all dead, but the author had the following to say: MOD me up! MOD files are like MIDI files, only the MOD includes it's own instrument set, called samples, and instructions on how to repeat and alter those samples to make a tune. Good news: there are nice-sounding, funny MOD files that are about 30KB in size. Better news: There is a popular library to play them! It's called Mikmod, and your distro has it (and it's a dependency for KDE's multimedia packages too). Even better news: It has support for playing simple sounds (samples in mod lingo) by calling a couple of functions. Awesome news: It includes a software mixer so you can just tell it to play this, then play that, then that, and a tune in the background, and everything sounds at the same time. So, we have a winner. This baby can handle everything I need for the game! But... is that a snake in your pocket? I can't find a Python binding for it. I am sure as soon as I post this article someone is going to come up and tell me, here they are, moron! But I just can't find any. So, I decided to do something I wanted to do already and learn to use Pyrex. Pyrex is a tool to write python extensions, with almost-free access to C libraries, in an almost-python language (only minor syntax differences). That way, I could write a Python module to use Mikmod. You know what? It was almost scarily simple 2. I didn't wrap all of Mikmod 3 because I don't need it, but now I can do stuff for games and apps almost trivially. Even more: Pyrex has awesome distutils support, so building the extensions, usually a pain in the rear, is trivial (mostly you just copy and delete stuff, with some search and replace). One thing I found I did nicely is this: Mikmod requires you to call Mikmod_Update every once in a while so it fills the soundcard's buffer with stuff to play. If you don't, it skips. So, I just started a thread that loops and takes care of it. You don't even have to know about it to use the extension. Oh, sure, if your Mikmod is not threadsafe, it breaks. Well, get a decent Mikmod package, then. How does it look? Here's a whole noisy proggie #Load the modules import mikmod, time #Init the library mikmod.init() #40 voices, 20 for music, 20 for random sounds (overkill) mikmod.setNumVoices(20,20) #Enable sound, starts the thread that pushes sound, too mikmod.enableOutput() #Create a module, that is, a music track module=mikmod.Module("BasicInstinct.mod") #Load two samples, just a couple of noises s1=mikmod.Sample("lost.wav") s2=mikmod.Sample("swap.wav") #Start playing the song module.play() #For the duration of the song, each second, make some noise while module.active(): s1.play() time.sleep(0.5) s2.play() time.sleep(0.5) #Close the mikmod library, stop the thread, etc. As you can see, the author has been successful in getting mikmod to work by writing his own bi
Re: [pygame] Choppy sound playback
Hi, I recently had a similar problem, and the solution, given to me, is below. It assumes you're running linux. Hope it helps. The first "export" line did the trick for me. If you need further help, you'll have to ask others. Cheers, Andrew. >you can force SDL to use ALSA or OSS by setting an environment variable, >see this page: http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars >You could try using the OSS emulation provided by ALSA: >$ export SDL_AUDIODRIVER=dsp >or: >$ export SDL_AUDIODRIVER=dma >then: >$ python program-name.py >or forcing ALSA: >$ export SDL_AUDIODRIVER=alsa >In my travels I've encountered stories of the ALSA OSS emulation working >"better" than the native ALSA drivers, I can't verify that though, >cheers, >John. Send instant messages to your online friends http://au.messenger.yahoo.com
Re: [pygame] sound crackling and fmod
Hi all, Regarding my crackling sound problem with Pygame, John wrote: >you can force SDL to use ALSA or OSS by setting an environment variable, >see this page: http://www.libsdl.org/cgi/docwiki.cgi/SDL_5fenvvars >You could try using the OSS emulation provided by ALSA: >$ export SDL_AUDIODRIVER=dsp >or: >$ export SDL_AUDIODRIVER=dma >then: >$ python program-name.py >or forcing ALSA: >$ export SDL_AUDIODRIVER=alsa >In my travels I've encountered stories of the ALSA OSS emulation working >"better" than the native ALSA drivers, I can't verify that though, First things first: I tried your first suggestion: export SDL_AUDIODRIVER=dsp and then I ran the Shadow of the Beast demo. It worked perfectly. I haven't even bothered with the other options you mentioned, as the first did the trick. Thanks heaps. I also tested another demo, that had also crackled, and that works fine too now, with the same "export" line. All I do now is write a simple script that does the export and then runs Python on the demo. Simple. Thanks again John, and thanks also to takis and others for your help too. Hopefully this info will help other Python developers who may have similar problems with Linux and Pygame. I'm still keen to get PySonic (that uses Fmod) to work with Linux. Fmod is excellent; I've used it before to make a c++ game with DirectX and I recommend it to everyone. The only problem is that I can't compile a Linux version. Despite that, I can now get Ogg and wave files playing properly, so one thing at a time. But if anyone does know how to get PySonic to work with Linux, please tell me. Thanks again everyone. Cheers, Andrew. Send instant messages to your online friends http://au.messenger.yahoo.com
Re: [pygame] sound crackling and fmod
Hi Takis, >Do the following (this time AFTER the pygame.init()): >pygame.mixer.quit() >pygame.mixer.init(44100,-16,1,4096) >report back >Takis Sorry, but that didn't solve the problem. I recall the sound was even worse (!) I suspect, as did another member of the mailing list, that it's a problem with my OS (Ubuntu Feisty Fawn) setup, rather than Pygame, perhaps something related to ALSA or OSS (whichever SDL is using for audio I don't know). Thanks for your help; if you have any other ideas, please tell me. Cheers, Andrew. Send instant messages to your online friends http://au.messenger.yahoo.com
Re: [pygame] sound crackling and fmod
Hi, - Original Message From: Παναγιώτης Τσιμπέρης <[EMAIL PROTECTED]> To: pygame-users@seul.org Sent: Monday, 30 April, 2007 6:23:34 PM Subject: Re: [pygame] sound crackling and fmod Ooopss... Just before the pygame.init() , write: pygame.mixer.pre_init(22050,-16,1,4096) just that. I've tried that, and unfortunately it doesn't solve the problem - I still get crackling music. Someone else suggested that I don't use pygame.init() because it inits everything, and that I should only init what I want, and one thing at a time (ie init display, init mixer). Unfortunately, that hasn't worked either. I reckon I've tried everything. I'm totally new to Python and Pygame and am really stuck here. Could it be an OS problem? I'm using Ubuntu Linux (Feisty Fawn) but others on the mailing list have said there's a bug in the Windows Pygame that causes sound crackle too. Any other ideas? Cheers, Andrew. Send instant messages to your online friends http://au.messenger.yahoo.com
Re: [pygame] sound crackling and fmod
Hi, >>1) why am I getting the crackling when running the >>demos? >open the game's code and change in the mixer's >initiation, the size of the buffer - it's the last >parameter. For instance if you find: >pygame.mixer.init() >then replace with: >pygame.mixer.init(22050,-16,1,2048) >or even: >pygame.mixer.init(22050,-16,1,4096) >that should fix it. Unfortunately, I still can't solve the problem. The demo code has no call to pygame.mixer.init. Instead, the code (the Shadow of the Beast animation on the website) looks like: ... pygame.init() screen = pygame.display.set_mode((640, 480)) pygame.display.set_caption("Shadow of the Beast") s1 = pygame.image.load(os.path.join("resources", "bgd1_ciel.png")) s2 = pygame.image.load(os.path.join("resources", "bgd2_montagnes.png")) s3 = pygame.image.load(os.path.join("resources", "bgd3_sol1.png")) s4 = pygame.image.load(os.path.join("resources", "bgd4_sol2.png")) s5 = pygame.image.load(os.path.join("resources", "bgd5_sol3.png")) s6 = pygame.image.load(os.path.join("resources", "sprite_nuages1.png")) s7 = pygame.image.load(os.path.join("resources", "sprite_nuages2.png")) s8 = pygame.image.load(os.path.join("resources", "sprite_nuages3.png")) s9 = pygame.image.load(os.path.join("resources", "sprite_nuages4.png")) s10 = pygame.image.load(os.path.join("resources", "sprite_barriere.png")) s11 = pygame.image.load(os.path.join("resources", "fireworks.png")) s12 = pygame.image.load(os.path.join("resources", "sprite_arbre.png")) s13 = pygame.image.load(os.path.join("resources", "scrolltext.png")) music = pygame.mixer.Sound(os.path.join("resources", "remix.ogg")).play() pygame.mouse.set_visible(False) and then the main game loop. There is no call in the same code to pygame.mixer(), so I added one as you suggested, and even tried it in several places, like after pygame().init, after the screen opening, after the call to start the music, and so on, changing only one line for each test, but had no luck. I checked out the webpage on the use of the mixer, and found there's a pre_init() call that can be used before pygame.init(). I even tried that, but it made no difference. I then decided to use Synaptic Package Manager to re-apply the libsdl mixer library, in case that was the problem. Still no luck. By the way, as I mentioned in the original post, I'm using ubuntu Linux. Any help would be much appreciated. Thanks in advance, Andrew. Send instant messages to your online friends http://au.messenger.yahoo.com
Re: [pygame] pygame and Ubuntu
Hi Jason, >I am trying to install pygame on the Ubuntu Linux operating system but I >cannot find it in any software repository. Could someone tell me where to >find a copy in a software repository for Ubuntu? Look for "python-pygame " with Synaptic package manager. That's where I found it. Cheers, Andrew. Send instant messages to your online friends http://au.messenger.yahoo.com
[pygame] sound crackling and fmod
Hi, I'm totally new to Python and Pygame, and have started by testing out the demos on the Pygame website. I'm using Ubuntu Linux. When I ran the "Shadow of the Beast" demo from the website, the animation was great but the sound (an Ogg file) was crackly on my speakers. I decided to try out other demos from the same website, and they too crackled. Seemed like a problem with my speakers, but when I played the same Ogg file with ubuntu's Totem Movie Player, the music played perfectly. I'm wondering why. If anyone out there is using ubuntu Linux and has any ideas, please help. Secondly, I've already used the excellent sound package, Fmod, in a c++ game I made, and have tested Fmod with java successfully, but I don't know how to use it with Pygame. I thought Fmod would be the best choice (rather than the Pygame mixer that is called in the demos, which seems to cause crackling). I have downloaded the latest Fmod for Linux, and have downloaded pySonic too. Unfortunately, the pySonic binary download is for Windows only. I did some web searching, and someone said that he's heard pySonic will work under Linux, but that you have to use PyRex, and follow special build instructions. The final result should be a shared object file for linux. I downloaded the required source code from sourceforge, and tried to follow the build instructions, but my call to gcc failed and I so I couldn't complete the build properly. This is frustrating. Surely someone has pySonic in a shared object form for linux? I plan to use Python and Pygame, and also to have the power of Fmod. Can someone please help out here with regard to the two problems: 1) why am I getting the crackling when running the demos?, and 2) How to I get a copy of Fmod in shared object form (for linux)? Thanks in advance. Cheers, Andrew. Send instant messages to your online friends http://au.messenger.yahoo.com