bastibe/PySoundCard

RuntimeError: Invalid device info! on Windows-AMD64/Anaconda/Python 2.7

Closed this issue · 3 comments

I'm running into issues when initializing streams, e.g.:

RuntimeError                              Traceback (most recent call last)
<ipython-input-21-66b8c9adeb22> in <module>()
     11 
     12 blocksize = 16
---> 13 s = Stream(samplerate=fs, blocksize=blocksize)
     14 s.start()
     15 s.write(wave)

C:\Users\liuji\Anaconda3\envs\nsgt-play3\lib\site-packages\pysoundcard.pyc in __init__(self, sample_rate, block_length, input_device, output_device, callback, finished_callback, **flags)
    353         """
    354         if input_device is True:
--> 355             input_device = default_input_device()
    356         if output_device is True:
    357             output_device = default_output_device()

C:\Users\liuji\Anaconda3\envs\nsgt-play3\lib\site-packages\pysoundcard.pyc in default_input_device()
    267     """Returns data about the default audio input device."""
    268     idx = _pa.Pa_GetDefaultInputDevice()
--> 269     return _dev2dict(_pa.Pa_GetDeviceInfo(idx), idx)
    270 
    271 

C:\Users\liuji\Anaconda3\envs\nsgt-play3\lib\site-packages\pysoundcard.pyc in _dev2dict(dev, index)
    224 def _dev2dict(dev, index):
    225     if dev == ffi.NULL:
--> 226         raise RuntimeError("Invalid device info!")
    227     if 'DirectSound' in list(apis())[dev.hostApi]['name']:
    228         enc = 'mbcs'

RuntimeError: Invalid device info!

I installed the latest binary installer (after running wheel convert) on an Anaconda installation. Is this a known issue, or are there any things I can do to help debug?

It seems that Portaudio reports an invalid default device. You will have to manually specify the device ID you want to use.

Does this issue go away if you manually select a device ID?

@bastibe I ended up switching to SoundDevice based on recommendation in another issue thread -- haven't had a chance to go back and check whether device ID switch works.