Re: Importing WAV files

12 views
Skip to first unread message

William Stein

unread,
Feb 28, 2012, 1:21:22 AM2/28/12
to Jacob Lundgren, sage-uw
On Mon, Feb 27, 2012 at 9:34 PM, wrote:
> I have been trying for a long time to start playing around with a wave file
> that I imported and I cannot figure it out.  I tried
>
> fs = open(DATA+'Flyin_Solo_Idea.wav')
> fs.getlength()
>
> This is not working for me, do I need to import something?
>

READ

http://docs.python.org/library/wave.html

Also see

help(sage.media.wave)

in Sage. I guess the wave file has to be uncompressed. I have no
idea how to uncompress a wave file.

You could also try:

import scipy.io.wavfile
help(scipy.io.wavfile)

I tried a few compressed wav files and it failed on them.

You can also try googling for "python wav", which will result in many
hits, e.g.,

http://stackoverflow.com/questions/2060628/how-to-read-wav-file-in-python

Obviously it *should* be the case that one can just do:

sage: a= load('most_an_file.wav')

and get back something nice and useful, or get a useful error message.
But nobody has implemented anything like that yet in Sage! I wish
they had.

-- William

Reply all
Reply to author
Forward
0 new messages