Open SoulProficiency opened 1 year ago
Maybe running on a different thread is simply not supported by ASIO?
Just try to start the stream on the main thread.
For a GUI example, see https://github.com/spatialaudio/python-sounddevice/blob/master/examples/rec_gui.py
Maybe running on a different thread is simply not supported by ASIO?
Just try to start the stream on the main thread.
For a GUI example, see https://github.com/spatialaudio/python-sounddevice/blob/master/examples/rec_gui.py
you're right, thanks. solve it by running it in another process.
I'd like to emphasize the very good remark of @mgeier with my personal experience:
I created a script composed of a GUI and some sounddevice code, which finds its close origin from examples/asyncio_generators.py
.
I developped everything on MacOS and it worked there. When I tried to run it on Windows, crack the error:
Error opening Stream: Unanticipated host error [PaErrorCode -9999]: 'Failed to load ASIO driver' [ASIO error 0]
File "C:\Users\AtelierEQUIUM\AppData\Local\Programs\Python\Python310\Lib\site-packages\sounddevice.py", line 2745, in _check raise PortAudioError(errormsg, err, hosterror_info)
I have tried on the same computer and same device examples/play_sine.py
and a very simple implementation of sd.playrec
and it works.
Here is a part of my code with this threading thing that I suppose being the issue.
import threading
import asyncio
import sounddevice as sd
class App()
def _asyncio_thread(self):
try:
self.async_loop.run_until_complete(self.audio_trigger()) # goes to something very close to examples/asyncio_generators.py
except: pass
def __init__(self):
# do some GUI stuff that calls this following line when starting audio:
threading.Thread(target=self._asyncio_thread, args=()).start()
async_loop = asyncio.new_event_loop()
asyncio.set_event_loop(async_loop)
app = App(async_loop)
SOLUTION:
Just had to remove this threading.Thread(target=self._asyncio_thread, args=()).start()
, replace it by a simple self._asyncio_thread()
and it works smoothly.
Windows 10 Soundcard: RME FIreface 802a
I want to use a pyqt5 GUI to playback a sound with a soundcard. The index of my asio Fireface USB is 66.
its work.so i try to use this function within a pyqt5 GUI and create a thread to control.
but its fail.
how can we fix it,thanks a lot.
soundcare info:Fireface UFX, connected with 8 loudspeakers
![2](https://user-images.githubusercontent.com/71921740/198016549-364d6288-623a-45b3-92f5-b5f9bab19880.jpg)