Playing mp3 files with wxPython 
Author Message
 Playing mp3 files with wxPython

I'm writing a wxPython app under Windows, and trying to play mp3 files
in it.  I've tried using snack, amd although it will work from the
command prompt, it won't work from within the application.  Does
anyone know a way to play mp3 files from within a wxPython
application.

I'm an newbie to python and don't know much about dll loading or
threading.  I would be willing to buy a third party dll if necessary,
assuming it could be used within wxPython.  I also considered opening
a thread to use snack (which is basically a Tkinter app), but didn't
have any success.

Any advice on playing mp3 files or mp3 dlls would be greatly
appreciated.



Tue, 24 Feb 2004 11:11:46 GMT  
 Playing mp3 files with wxPython

Quote:
> Any advice on playing mp3 files or mp3 dlls would be greatly
> appreciated.

pygame can stream mp3 audio. although i'll admit the decoding
done by the SMPEG library doesn't work on all the mp3s out
there. but as long as its nice basic mp3, there's a good chance
it will fly for you :]

you can use pygame's audio without bringing in all the other
bells and whistles it has. the code would resemble this..
--------------------------

import pygame.mixer as mixer
mixer.init(44100)
mixer.music.load('mymusicfile.mp3')
mixer.music.play()

---------------------------
after that you can make a call to "mixer.music.get_busy()" to
see if it is still playing. streaming and decoding all happens
in a background thread.

it's totally free to use, but i admit the mp3 support isn't
100%. other formats like OGG, MOD, WAV, have no trouble, if
that would be better for you :]



Tue, 24 Feb 2004 12:42:57 GMT  
 Playing mp3 files with wxPython


I've tried pygame but get the following error when I call load() for
an mp3 file:
  File "<stdin>", line 1, in ?
pygame.error:  Module format not recoginized

pygame works fine for wav files, but another part of my application
requires mp3.  As a work around, I would consider converting my mp3 to
wav so it can be played, then discarding the wav.  However I don't
know a python way to convert mp3 to wav.

Quote:

>> Any advice on playing mp3 files or mp3 dlls would be greatly
>> appreciated.

>pygame can stream mp3 audio. although i'll admit the decoding
>done by the SMPEG library doesn't work on all the mp3s out
>there. but as long as its nice basic mp3, there's a good chance
>it will fly for you :]

>you can use pygame's audio without bringing in all the other
>bells and whistles it has. the code would resemble this..
>--------------------------

>import pygame.mixer as mixer
>mixer.init(44100)
>mixer.music.load('mymusicfile.mp3')
>mixer.music.play()

>---------------------------
>after that you can make a call to "mixer.music.get_busy()" to
>see if it is still playing. streaming and decoding all happens
>in a background thread.

>it's totally free to use, but i admit the mp3 support isn't
>100%. other formats like OGG, MOD, WAV, have no trouble, if
>that would be better for you :]



Tue, 24 Feb 2004 20:46:33 GMT  
 Playing mp3 files with wxPython

Quote:


> I've tried pygame but get the following error when I call load() for
> an mp3 file:
>   File "<stdin>", line 1, in ?
> pygame.error:  Module format not recoginized

> pygame works fine for wav files, but another part of my application
> requires mp3.  As a work around, I would consider converting my mp3 to
> wav so it can be played, then discarding the wav.  However I don't
> know a python way to convert mp3 to wav.

Use .ogg files instead. They have the same features as MP3s, but (IMHO)
they're of better quality.

--



Tue, 24 Feb 2004 21:35:20 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Play MP3 file

2. Can use python to play MP3 file?

3. MP3 MP3 MP3

4. need subroutine for MP3 playing

5. Playing an mp3 in Clarion4?

6. Playing MP3

7. mp3 to wav, wav to mp3

8. rb3 and mp3 files??

9. Using mp3 files and database over a network

10. Clarion and mp3 Files

11. Fade-in / Fade-out MP3 Files

12. MP3 Files - Reading Information

 

 
Powered by phpBB® Forum Software