[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[pygame] Tone Generator with Pygame, SciKits AudioLab & SciPy - Less laggy method?



I wrote a simple pygame program to read MIDI events and generate/play sine wave sounds using scikits audiolab and scipy modules. (The code is here: pastebin.com/VTBQxjQm )

It is working, but it takes about half a second to repeat the “scikits.audiolab.play()” method.

    f = 440*(2**((mymidinumber-69)/12))  

    x = scipy.cos((2*scipy.pi*f/fs)*scipy.arange(fs*T))
    print "before method, this is quick!"
    scikits.audiolab.play(x,fs)          #<====this is the laggy method
    print "after method, this is laggy"

Can anyone recommend a faster method for playing sine waves? Perhaps there is a better Audiolab method or different module?


Any suggestions, snippets or links would be greatly appreciated.