Description:
On macOS, recording audio with sounddevice does not trigger a microphone permission prompt and fails to record when run in Spyder or JupyterLab. This works as expected in VS Code and Jupyter Notebook.
Environment:
- macOS: 15.1.1
- Python: 3.12.7
- sounddevice: 0.5.1
- Spyder: 6.0.1
- JupyterLab: 4.2.5
Steps to Reproduce:
- Run the following code in Spyder or JupyterLab on macOS.
- No permission prompt appears.
- Recording fails.
import sounddevice as sd
import matplotlib.pyplot as plt
duration = 3
fs = 16000
print("Recording...")
audio = sd.rec(int(duration * fs), samplerate=fs, channels=1)
sd.wait()
plt.plot(audio)
plt.show()
print("Playing...")
sd.play(audio, fs)
sd.wait()