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 

Standard tutorials on a web site

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


Joined: 12 Nov 2004
Posts: 1675

PostPosted: Thu Aug 25, 2005 2:58 pm    Post subject: Standard tutorials on a web site Reply with quote

The following tutorials can be found on a web site:

Playing a WAV file
Uncompressing an audio stream
Simple audio player
Recode audio

More samples are on the site:
http://pymedia.org/tut/index.html

Dmitry/
Back to top
View user's profile Send private message
tim.tadh



Joined: 16 Mar 2006
Posts: 1

PostPosted: Thu Mar 16, 2006 8:54 pm    Post subject: Reply with quote

I took a look at the simple audio player tutorial (not the bigger piece of code [i didn't test that one] but the step by step guide), and the code doesn't actually work.

here is code that does work:

Code:

import pymedia
import time

demuxer = pymedia.muxer.Demuxer('mp3')

f = open(YOUR FILE HERE, 'rb')


spot = f.read()
frames = demuxer.parse(spot)
print 'read it has %i frames' % len(frames)
decoder = pymedia.audio.acodec.Decoder(demuxer.streams[0])
frame = decoder.decode(spot)
print dir(frame)
sound = pymedia.audio.sound
print frame.bitrate, frame.sample_rate
song = sound.Output( frame.sample_rate, frame.channels, 16 )

while len(spot) > 0:
    try:
        if frame: song.play(frame.data)
        spot = f.read(512)
        frame = decoder.decode(spot)
    except:
        pass
   
while song.isPlaying(): time.sleep(.05)
print 'well done'
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