[SOLVED] - I am making an alarm clock in python. This requires me to play a sound file just once. What is the easiest method to play a wav or ogg? I looked into the solutions and I saw people recommend pyMedia and ossaudiodev. Is pyGame a good idea?
Also, how would I even start to import something like pyGame? I know to add import pygame, but I do not know where I should put all the pygame code.
Playing sound
Started by mevets, Oct 04 2007 05:09 PM
3 replies to this topic
#1
Posted 04 October 2007 - 05:09 PM
Steve M.
|
|
|
#2
Posted 04 October 2007 - 09:07 PM
Which platform are you using?
I only know one way, if you are going to use the standard libraries, but it's only compatible with Windows.
It's pretty easy to install new libraries. In your Python-directory, you've a file called "Lib," you just need to place the files in there. The library will probably have a README og INSTALL file, which would help you, if it need configuration, or something else first.
I only know one way, if you are going to use the standard libraries, but it's only compatible with Windows.
import winsound
winsound.PlaySound("sound.wav", winsound.SND_FILENAME)
So if you're aiming for making your script cross-platform, or if you're on another platform, you probably need to use some third-party library, but I can't say which one is good for your purpose.It's pretty easy to install new libraries. In your Python-directory, you've a file called "Lib," you just need to place the files in there. The library will probably have a README og INSTALL file, which would help you, if it need configuration, or something else first.
#3
Posted 05 October 2007 - 06:33 AM
I am using linux. Someone said pyGame would be easiest. Does anyone know where pythons lib folder is located under linux? I saw /var/lib/python2.5. Is that it?
Steve M.
#4
Posted 09 October 2007 - 06:20 PM


Sign In
Create Account


Back to top









