Over here we use numarray to cast the data that we get from the decoder as an array of numbers.

On 13/03/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Send Pymedia-users mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
         https://lists.sourceforge.net/lists/listinfo/pymedia-users
or, via email, send a message with subject or body 'help' to
         [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Pymedia-users digest..."


Today's Topics:

   1. decode data format (Chris Haynes)

--__--__--

Message: 1
Reply-To: <[EMAIL PROTECTED]>
From: "Chris Haynes" <[EMAIL PROTECTED]>
To: "Pymedia" < [email protected]>
Date: Sun, 12 Mar 2006 20:27:07 -0500
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]






--__--__--

_______________________________________________
Pymedia-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/pymedia-users


End of Pymedia-users Digest

Reply via email to