InDashPC.org Forum Index InDashPC.org
In Dash Car PC forum
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Third Tutorial Problem

 
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software -> PyMedia Tutorials
View previous topic :: View next topic  
Author Message
Geometrian



Joined: 03 Aug 2007
Posts: 2

PostPosted: Fri Aug 03, 2007 10:36 am    Post subject: Third Tutorial Problem Reply with quote

Hi,
I'm trying to use pymedia to make a music player. I copied the tutorial:

Code:
import pymedia.audio.acodec as acodec
sName='myfile.wav'
dec= acodec.Decoder( str.split( sName, '.' )[ -1 ].lower() )

f= open( sName, 'rb' )
s= f.read( 8192 )
r= dec.decode( s )

import pymedia.audio.sound as sound
snd= sound.Output( r.sample_rate, r.channels, sound.AFMT_S16_LE )

while len( s )>0:
    if r: snd.play( r.data )
    s= f.read( 512 )
    r= dec.decode( s )

import time
while snd.isPlaying(): time.sleep( .05 )


...but it gives me a error:

"ACodecError: Codec(): First parameter should be dict (codec id and params)"
Back to top
View user's profile Send private message
jbors
Site Admin


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Sun Aug 05, 2007 7:07 pm    Post subject: Reply with quote

Try recode_audio.py from examples.
Tutorial was not updated to the latest pymedia Sad
Back to top
View user's profile Send private message
Geometrian



Joined: 03 Aug 2007
Posts: 2

PostPosted: Sun Aug 05, 2007 7:10 pm    Post subject: Reply with quote

I had actually forgotten about this post Rolling Eyes

I finally got one or two of the tutorials working, but not well; this should help me get them working right. Thanks!

Geometrian
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    InDashPC.org Forum Index -> Software -> PyMedia Tutorials All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group