Play MP3s from Windows

Arlie arlie.c at gmail.com
Fri Jun 19 20:57:01 EDT 2009


On Jun 20, 8:07 am, Tim Harig <user... at ilthio.net> wrote:
> On 2009-06-19, Arlie <arli... at gmail.com> wrote:
>
> > print 'Duree du fichier : ',buf,' millisecondes'
>
> You can obviously make sure that 'buf' can be accessed as a string.
>
> > time.sleep(int(buf)/1000)
>
> The error seems to be having issues converting buf to an int.  Could you
> possibly convert it to a string before converting it to an int?
>
> time.sleep(int(str(buf))/1000)

I'm still getting same error. So I just did this:

...

mci=mci()
mci.directsend('open "d:\\Linger.mp3" alias toto')
mci.directsend('set toto time format milliseconds')
err,buf=mci.directsend('status toto length ')
print 'Duree du fichier : ',buf,' millisecondes'
soundlength = int(buf) / 1000
err,buf=mci.directsend('play toto from 0 to '+str(buf))
#time.sleep(int(buf)/1000)
time.sleep(soundlength)
mci.directsend('close toto')




More information about the Python-list mailing list