Open phoenix-meadowlark opened 3 years ago
This is quite bad, but I don't know what I could do about it on the Python side.
What happens if you select a different dtype
?
What happens if you use other software that uses PortAudio, e.g. Audacity?
I downgraded to python 3.6.10
to use pyaudio
earlier this week, and that is working as expected.
I installed sounddevice
in the same venv
and am observing the same behavior described above. pyaudio
was 'recording' all zeros when I tried to run it from vscode's terminal, but it works when running from iterm
(which I was able to give microphone permissions). sounddevice
behaves the same in both terminal environments.
Thanks for the update!
Both PyAudio and the sounddevice
module use PortAudio, so I would expect the same behavior ...
Maybe you are using different versions?
What does sd.get_portaudio_version()
say?
What is the value of sd._libname
?
Have you installed portaudio
with brew
?
You can try to compile the latest version, or you can try to uninstall it, maybe that helps.
If it still doesn't work, there is hope nevertheless, because it looks like a new PortAudio release will happen within the next few weeks!
Try the blocking=True
argument. Fixed the same problem for me, because I was mistakenly drawing the graph before waiting for the recording to finish.
Thanks @imyxh, I totally overlooked this!
Instead of blocking=True
one can also use sd.wait()
.
On macOS this code is producing a mixture of NaN, all-zero and ~10**38 amplitude waves: