Closed fvviz closed 2 years ago
What sort of mic are you using? Pure zeros usually mean that there is no microphone connected. What operating system are you running?
I am running macOS Big Sur on the late 2020 M1 MacBook Pro. The mics I'm using are the default laptop mic and an AirPods mic. Both of these mics worked on PyAudio but won't work on Soundcard
What does print(mic)
say, exactly? Does it change if you supply a channel map?
when I'm on my laptop mic print(default_mic)
gives me <Microphone MacBook Pro Microphone (1 channels)>
when I'm on my AirPods it gives me <Microphone Faizs AirPods (1 channels)>
. And what is a channel map though?
Thank you. That output looks normal. Honestly, I have no idea what is causing this issue. But macOS has silently changed its audio APIs multiple times in the past, so I wouldn't put it past them to have done so again.
Pure zeros are usually macOS's way of telling you that no microphone is connected. Apparently now it is also used to signal some kind of error condition. I'm afraid I can't help you beyond this, since I don't have a modern Mac to test on.
But the code is pretty straight-forward, so you might be able to debug it yourself. Start with the _Recorder
object in coreaudio.py and use print-debugging as any runtime-debugger would mess up macOS's callback model. If you do look into this, I'll try to help you as best I can!
Hi, Bastibe I have the same issue with a Scarlett 8I6 macOS Big Sur also I change the sample rate to 44100 because using logic to record defaults to that. Also when I hardcode 48khz into the Focusrite software Logic stops monitoring of input. I check on _Recorder object to see If I get somewhere.
The problem is Microphone Permission. I just added Microphone permission to Iterm and the problem is solved
Thank you for figuring that one out! So if I understand you correctly, this only affects users of a non-default Terminal app?
Would you like to contribute the exact steps necessary to the README?
Yes the real problem is the most common places where people run their scripts on macos is from vscode (that has a well documented bug since macos Mojave) and iterm that also doesn't ask for permission.
I try to fix this at script level so that soundcard ask for it regardless of the top application in the meantime I add the workaround to the readme.
Add issue to readme https://github.com/bastibe/SoundCard/pull/148
given there's a note in readme now, perhaps this could be closed?
I'm ok with closing this
This is the code (I've taken it from the docs)
when I run the code the sound does not play. At first I thought this was a problem with the speaker object but then I tried playing a saved wav file separately using the speaker object and it worked but when I try to play the mic input there is no sound output, also there is this warning
The
data
variable when printed returns an array with nothing other than 0.0