You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I run this minimal example, everything works fine.
importsounddeviceassdimportnumpyasnpFS=44100sd.default.device=45# This is an ASIO devicedefrun():
print("Running playrec...")
sd.playrec(np.zeros((FS, 1)), FS, channels=1)
print("Done!")
if__name__=="__main__":
run()
But when I introduce the DearPyGui framework and try to execute the same function from a callback I get an error.
importnumpyasnpimportsounddeviceassdimportdearpygui.dearpyguiasdpgFS=44100sd.default.device=45# This is an ASIO devicedefrun():
print("Running playrec...")
sd.playrec(np.zeros((FS, 1)), FS, channels=1)
print("Done!")
if__name__=="__main__":
dpg.create_context()
withdpg.window():
dpg.add_button(label="Run playrec", callback=run)
dpg.create_viewport()
dpg.setup_dearpygui()
dpg.show_viewport()
dpg.start_dearpygui()
dpg.destroy_context()
Running playrec...
Traceback (most recent call last):
File "C:\Users\User\Documents\test.py", line 11, in run
sd.playrec(np.zeros((FS,1)), FS, channels=1)
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 369, in playrec
ctx.start_stream(Stream, samplerate,
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 2582, in start_stream
self.stream = StreamClass(samplerate=samplerate,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 1800, in __init__
_StreamBase.__init__(self, kind='duplex', wrap_callback='array',
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 898, in __init__
_check(_lib.Pa_OpenStream(self._ptr, iparameters, oparameters,
File "C:\Users\User\AppData\Local\Programs\Python\Python311\Lib\site-packages\sounddevice.py", line 2745, in _check
raise PortAudioError(errormsg, err, hosterror_info)
sounddevice.PortAudioError: Error opening Stream: Unanticipated host error [PaErrorCode -9999]: 'Failed to load ASIO driver' [ASIO error 0]
This only happens when I try to use an ASIO device. For example, MME works fine. Does anyone know why this is happening?
Interestingly, if I put the import statement inside the function. It works. But you have to remove the initial import on line 2, if it's there it still breaks.
defrun():
print("Running playrec...")
importsounddeviceassdsd.default.device=45# This is an ASIO devicesd.playrec(np.zeros((FS, 1)), FS, channels=1)
print("Done!")
Windows 10
sounddevice 0.4.6
Python 3.11.4
The text was updated successfully, but these errors were encountered:
When I run this minimal example, everything works fine.
But when I introduce the DearPyGui framework and try to execute the same function from a callback I get an error.
This only happens when I try to use an ASIO device. For example, MME works fine. Does anyone know why this is happening?
Interestingly, if I put the import statement inside the function. It works. But you have to remove the initial import on line 2, if it's there it still breaks.
Windows 10
sounddevice 0.4.6
Python 3.11.4
The text was updated successfully, but these errors were encountered: