bastibe / PySoundCard

PySoundCard is an audio library based on PortAudio, CFFI and NumPy
BSD 3-Clause "New" or "Revised" License
87 stars 9 forks source link

callback examples in README don't work #31

Closed valkyriesavage closed 10 years ago

valkyriesavage commented 10 years ago

I'm running in OSX, and copy/pasting the callback-style examples straight up does not work for me.

TypeError: 'long' object does not support item assignment From callback <function callback_stub at 0x1018f4d70>: Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/pysoundcard.py", line 424, in callback_stub time_info, status_flags) File "fivesecondslivecallback.py", line 7, in callback out_data[:] = in_data

bastibe commented 10 years ago

Thank you for the bug report!

We are currently working on the next major release, and we updated the README too early.

The correct example for the old version would be:

def callback(in_data, time_info, status):
    return (in_data, continue_flag)

As you can see, the old code passed recorded data into the callback, and the callback should return data for playback. The current code passes both recorded data and playback data into the callback.

Sorry for the confusion.

bastibe commented 10 years ago

I just updated the README accordingly.

valkyriesavage commented 10 years ago

Thanks!