[SciPy-User] parsing a wave file

Warren Weckesser warren.weckesser@enthought....
Thu Feb 23 07:26:14 CST 2012


On Thu, Feb 23, 2012 at 5:04 AM, David Hutto <smokefloat@gmail.com> wrote:

> Hi,
> I'm using scypy 0.10.1RC2 amd 64 with python 2.7.
> I'm attempting to parse a wav file to access the data chunks to show
> the values for use
> in an oscilloscope(to know the intended usage, and maybe  a better way
> to go about the solution).
>
> The following code:
> .
>
> ####################
>                f = Sndfile(r'c:\Users\david\test01.wav', 'r')
>                fs = f.samplerate
>                nc = f.channels
>                enc = f.encoding
>                data = f.read_frames(1000)
>                frame_amount = 1000
>                data_float = f.read_frames(frame_amount, dtype=np.float32)
>                for i in range(0,frame_amount,1):
>                        print data_float[i]
>        ##############
> returns data_float[i] in the form:
> [-1,0.990988]
> [.08545,-0.009988]
> etc.
>
> My question is, is this the portion of data I'm parsing for(I'm almost
> positive it's not), or is there another data chunk? The graphing of
> the given data displays nothing close to the supplied current being
> recorded in the wav file.
>
> Any suggestions as to what I'm parsing in the wrong way, or better
> solutions than the above?
>
>
>

Can you use the  wavfile module in scipy.io?  E.g.

>>> from scipy.io import wavfile
>>> fs, data = wavfile.read(r'c:\Users\david\test01.wav')


Warren
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120223/04a8496a/attachment.html 


More information about the SciPy-User mailing list