hearing data?

When I was contemplating a new way of doing things, the first thing that came to mind was a spreadsheet and showing students how to use it as a playground for analyzing data.  The second thing that came to mind as a demonstration of geometric sequences was to hear the data.  I love a command in Mathematica called Play (which I found in their Documentation Center), which takes a function specifying a sound and plays it.  To build on this, what I wanted was to take a sequence of frequencies, generate brief pure tones, and play them in succession.  Easy, right?  It would have been if I had Mathematica, but when I stopped being a student, I let my license lapse.  So I thought I could do it in Python.  It turns out that sound libraries are a pickle to get straightened out.  There are so many, and on top of this I’m having trouble compiling/installing them on Mac OS X.  What have I tried?

  • Snack (required Tcl/Tk Aqua, which isn’t bad to have anyway)

    error reading package index file /Library/Tcl/tdbc1.0b1/pkgIndex.tcl: expected version number but got "1.0b1"
    Traceback (most recent call last):
    File "sound.py", line 20, in
    tkSnack.initializeSnack(root)
    File "/usr/local/lib/python2.6/site-packages/tkSnack.py", line 23, in initializeSnack
    Tkroot.tk.call('snack::setUseOldObjAPI')
    _tkinter.TclError: invalid command name "snack::setUseOldObjAPI"

    It sounds like some sort of screwy version mismatch, but I found a hint. This fixed it. It turns out that Snack can play pure tones using a generator, so it solves my tone problem but it can’t play any waveform without some work.

  • PyAudio
  • PyGame (didn’t like my Fink-installed SDL, but I didn’t pursue further.)
  • PyAudiere

I’ll have to update this later when I have more time to mess with it…

Advertisements
Published in: on 2009.06.04 at 16:26  Leave a Comment  
Tags: , ,