Hi Chris,
Try
str( r.data ) to get string object out of r.data.
Regarding the task you need, can you clarify what you mean by "playing
directly in python without going through a file" ?
There are number of examples in the tutorail on a web site which do that.
http://pymedia.org/tut/index.html
Dmitry/
----- Original Message -----
From: "Chris Haynes" <[EMAIL PROTECTED]>
To: "Pymedia" <[email protected]>
Sent: Sunday, March 12, 2006 5:27 PM
Subject: [Pymedia-users] decode data format
Following the tutorial, I decode a frame and try to access r.data.
len(r.data) returns a sensible number, but type(r.data) and r.data[0:10]
crash python and result in an error message, resp. See the appended code.
I
want to access the data as a list of numbers (int or float). Any way to do
this with pymedia?
If not, I'd really appreciate suggestions of any other software that would
allow me (using python under xp) to decode mp3 or wav files in a way that
allows computation with the PCM data . After computation I also will need
a
way of saving the result in some standard codec and, if possible, playing
it
directly in python without going through a file.
Chris
import pymedia.audio.acodec as acodec, pymedia.muxer as muxer
dm = muxer.Demuxer('mp3')
f = open('/home/python/src/pymedia/gong.mp3', 'rb')
s = f.read(3000000)
frames = dm.parse(s)
frame = frames[0]
dec = acodec.Decoder(dm.streams[0])
r = dec.decode(frame[1])
print r.sample_rate, r.channels, len(s), # type(r.data)
print len(r.data), # r.data[0:10]
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users