[SciPy-User] parsing a wave file

David Hutto smokefloat@gmail....
Fri Feb 24 05:28:13 CST 2012


On Thu, Feb 23, 2012 at 8:26 AM, Warren Weckesser
<warren.weckesser@enthought.com> wrote:
>
>
> 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?
Yes, thanks for pointing that out.

E.g.
>
>>>> from scipy.io import wavfile
>>>> fs, data = wavfile.read(r'c:\Users\david\test01.wav')
>
>
> Warren
>
>
> _______________________________________________
> SciPy-User mailing list
> SciPy-User@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
>


More information about the SciPy-User mailing list