Open mlubbad opened 1 year ago
Figere unum conteram aliud
Firstly, your PR will make it impossible to use for Windows users (does not support the CoreAudio
API).
Secondly, even for MacOS users, your code will not work correctly.
As far as I know, PyAudio
, in its default form, cannot record audio from speakers on MacOS via CoreAudio
(probably outdated). And I would recommend using the Jack
API interface for this purpose.
If you just want to avoid installation errors (rather than using this functionality), then it will be enough to wrap all pyaudiowpatch
imports:
from
import pyaudiowpatch as pyaudio
to
try:
import pyaudiowpatch as pyaudio
except ImportError:
import pyaudio
But if you want to use the functionality of recording sound from speakers, then you need to look for a separate solution, or rewrite\modify PyAudio.
In this case, you may also have to separate the implementation for Windows and Linux\MacOS
I checked again, and came to the same conclusion - your code does not contribute to recording sound from the speakers. Especially on macOS using Core Audio.
Are you aware of what the code you modify is responsible for? This piece is responsible for recording sound from the speakers (what you hear). But at the moment, PyAudio does not support this functionality on macOS, especially through Core Audio. So your code shouldn't even work.
Then what did you mean when you said that everything works for you? You said that the application works well through the microphone, is it? This is how it worked before your changes.
I ask because your code does not contribute to either the first or the second.
I created a PR for your fork that adequately solves the problem in the second way(just bypass the errors).
It has been tested on both Windows and MacOS. All the nuances are described in the PR itself.
As far as I understand, you were not going to solve the problem with recording from the speakers. So I suggest that you accept my PR and we can move on to consider the merge.
You are right, done from my end.
I’ll try to support the right function (recording from the speaker through the microphone of the device) soon.
I’ll inform you once, I get success.
For now, I just accept and merged your PR, could we proceed?
Thanks 🌹
@SevaSk Hi🖐, I've made a change that solves the OP's problem: bypass startup errors on macOS..
I checked the work on Windows and macOS - *everything works. (Need someone to check too)
IMPORTANT: This is not a solution to the problem of recording sound from speakers on macOS, but only a workaround so that the application can work under this OS through a microphone. ❗ *It is also worth knowing that the speaker recording stream (on macOS) completely duplicates the microphone stream. This was the easiest way to get around the bugs without having to rewrite a big part of your code.
Not sure about the relative usefulness of this PR, but it will buy time before the problem of multi-platform speaker recording is fully resolved.
@mlubbad Yes, we will find out the opinion of the maintainer and probably proceed to merge.
It's all demagogy and endless dialogue. If you agree with my last comment, then just write what you think is necessary for this PR and I will implement it in any form you want. After all, this is your repository😉
Resolve setup issues for macOS (Venture 13.4): pyaudiowpatch -> pyaudio, context manager error, host API not found, KeyError, ..etc