Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can use python to play MP3 file?

52 views
Skip to first unread message

Ricky

unread,
Feb 28, 2002, 11:23:01 AM2/28/02
to
I hear that PHP can online play MP3 file. Is there any method that can make
me play MP3 by using Python CGI?

Thanks for any reply!


Sean 'Shaleh' Perry

unread,
Feb 28, 2002, 11:45:32 AM2/28/02
to

It does not play them, it sends them over the network so that a program on a
user's machine may play them. Most decent mp3 players allow you to connect to
a streaming server (as they are called) and play the songs as they are
transferred. Gives an affect like listening to the radio.

Gerhard Häring

unread,
Feb 28, 2002, 12:04:40 PM2/28/02
to

Do you want to play the MP3 file on the server, like a jukebox. Or do
you want to stream MP3 files back to the client computer?

(Of course you can do both with Python)

Gerhard

Tim Hammerquist

unread,
Feb 28, 2002, 5:58:08 PM2/28/02
to
Ricky <stor...@sina.com> graced us by uttering:

> I hear that PHP can online play MP3 file. Is there any method that
> can make me play MP3 by using Python CGI?

If you mean an MP3 stream server written in Python, try edna
<http://edna.sf.net/>. It will serve MP3s in a stream to the client
computer. (NB: it's up to the client to "play" the MP3, often through
MIME associations in the browser.)

If you mean you want an MP3 player written in Python, well, I don't
suggest it. Processing MP3 data is very processor intensive and is
often thought best accomplished with a compiled C program. However,
cymbaline <http://www.silmarill.org/cymbaline/> is a Python frontend
to the (very pervasive) mpg123 MP3 player.

You don't mention which OS, so I should mention, this is from a linux
perspective. edna might very well work on Windows.

HTH
Tim Hammerquist
--
$ echo pizza > /dev/oven

Tim H

unread,
Feb 28, 2002, 6:52:24 PM2/28/02
to

"Gerhard Häring" <ger...@bigfoot.de> wrote in message
news:3C7E6328...@bigfoot.de...

Do you have examples, links, hints to doing each with python?

Thanks,
Tim


Ricky

unread,
Mar 1, 2002, 1:04:48 AM3/1/02
to
Thank you for you all! I means I want to play a MP3 stream using a local MP3
player, while, I'd like to play with transfer stream not download the whole
file to my hard disk and play it.

now, what shall I do? download a special application or use a special
proctor which some thing like http:// news://?

Thank you!
"Tim Hammerquist" <t...@vegeta.ath.cx> wrote in message
news:slrna7tdg...@vegeta.ath.cx...

Gerhard Häring

unread,
Mar 1, 2002, 9:04:53 PM3/1/02
to
Le 28/02/02 à 16:52, Tim H écrivit:

> "Gerhard Häring" <ger...@bigfoot.de> wrote:
> > Ricky wrote:
> > > I hear that PHP can online play MP3 file. Is there any method that
> > > can make me play MP3 by using Python CGI?
> > >
> > > Thanks for any reply!
> >
> > Do you want to play the MP3 file on the server, like a jukebox. Or do
> > you want to stream MP3 files back to the client computer?
> >
> > (Of course you can do both with Python)
> >
> > Gerhard
>
> Do you have examples, links, hints to doing each with python?

Playing an MP3 file using pygame (http://www.pygame.org/):

import pygame.mixer as mixer

mixer.init(44100)
mixer.music.load("White Bird.mp3")
mixer.music.play()
mixer.music.get_busy()

print "Press enter to quit."
raw_input()


OTOH streaming MP3 files from the server to the client has IMHO little
to do with Python, it's more of a HTTP thing. As long as you've set the
correct content type and played the right tricks with HTML, it should
just work. FWIW, there's a streaming MP3 server written in Python at
Sourceforge: http://edna.sourceforge.net/

Gerhard
--
This sig powered by Python!
Außentemperatur in München: 4.0 °C Wind: 3.2 m/s

0 new messages