Closed dwater closed 6 years ago
This seems to imply that out_data
is an integer in this case, for some reason. Could you debug this and check the types of in_data
, out_data
, time_info
, and status
?
I suspect that your default audio device has only inputs or only outputs, in which case the callback will only be called with either in_data
or out_data
, but not both.
Furthermore, PySoundCard has been unmaintained for quite a while now. I recommend using either SoundDevice for a maintained version of the same API, or SoundCard, for something much easier to use.
I've checked the types of in_data, out_data, time_info, and status. The results are as follows: <class 'numpy.ndarray'> <class 'int'> <class 'dict'> <class 'int'>
I've changed the callback function. It works now. Thank you!
def callback(in_data, num_frames, time_info, status): return (in_data, continue_flag)
I got following runtime errors when running anyone of the test scripts context_manager.py, loopback_callback.py and playback_callback.py.
Here is the content of context_manager.py:
`from pysoundcard import Stream, continue_flag import time
"""Loop back five seconds of audio data."""
def callback(in_data, out_data, time_info, status): out_data[:] = in_data return continue_flag
with Stream(samplerate=44100, blocksize=16, callback=callback): time.sleep(5) `