![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#11 | |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Quote:
on the mp3 file ( I put one in I had) I get the following error message: pygame.error: Module format not recognized
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
|
#12 | |
|
Professional Programmer
Join Date: Feb 2005
Posts: 434
Rep Power: 4
![]() |
Quote:
However: # PyMedia wave play (from the tut examples)
# download: pymedia-1.3.5.0-pre2.win32-py2.4.exe
# free from: http://pymedia.org/
# works not well!!!! just noise!!!!
import pymedia.audio.sound as sound
import time, wave
def playWAV( fname ):
f = wave.open( fname, 'rb' )
sampleRate = f.getframerate()
channels = f.getnchannels()
format = sound.AFMT_S16_LE
print sampleRate, channels, format # test => 8000 1 16
snd1 = sound.Output( sampleRate, channels, format )
s = ' '
while len(s):
s = f.readframes( 1000 )
snd1.play( s )
# sound module is not synchronous, want everything to be played before exit
while snd1.isPlaying(): time.sleep( 0.05 )
if __name__== '__main__':
waveFile = 'boing.wav' # put in a wave file you have
playWAV(waveFile)
__________________
I looked it up on the Intergnats! |
|
|
|
|
|
|
#13 |
|
Programming Guru
![]() Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5
![]() |
It might be possible that the reason PyGame doesn't play MP3s natively is due to the same licensing issues that plague Linux. Maybe you just need the right libraries, or perhaps an Ogg will work better.
Regardless, I'll look into it when I get back from work, as I'd like to know as well. |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|