I get this error message when I try to run the following script, or any script with import sounddevice
at top. I installed sound device at cmd as admin with pip install sounddevice
and I verified it is there with pip list
Assertion failed!
Program: C:\Program Files\Python37\python.exe
File: src/hostapi/wdmks/pa_win_wdmks.c, Line 1061
Expression: FALSE
Example program:
import sounddevice
sounddevice.get_portaudio_version()
input('enter to exit')
Another example prog (from 1):
import sounddevice as sd
import soundfile as sf
data, fs = sf.read('ImperialMarch60.wav')
sd.play(data, fs)
status = sd.wait()
update/Further clarification:
I've tried reinstalling sounddevice and python as well as using sounddevice 0.3.12 or python 3.8.3 instead. I only have 1 ver of python installed at a time. I've had Audacity for a long time and that works.
Downloaded a whl from https://www.lfd.uci.edu/~gohlke/pythonlibs/#sounddevice
and ran pip install sounddevice-0.3.15-cp37-cp37m-win_amd64.whl
which installed but produced the same "assertion failed" error. I didn't think this was related but I couldn't do pip install pyaudio
bc it said Microsoft Visual C++ 14.0 is required
even though I installed Visual Studio Build Tools 2019, so I downloaded the gohlke whl for pyaudio and suddenly sounddevice works... so this is somewhat resolved but I don't get it. Perhaps portaudio is not "automagically" included in sounddevice for Windows as the sounddevice documentation says2?
Update2: I uninstalled the sounddevice whl and reinstalled using pypl version using pip install sounddevice
and now it works too...