step 1
install sounddevice pip install sounddevice
step 2
Go to sound device setting and Enable Stereo Mix
step 3
import sounddevice as sd
from scipy.io import wavfile
sd.default.device[0] = 0
def record():
duration = 10
frames = 44100
rec = sd.rec((frames * frames), samplerate = frames, blocking=True, channels=1)
wavfile.write('test.wav', frames, rec)
record()
Now we're done 🤗
Don't forget to like and follow 🙂
Support me on PayPal 🤗
https://www.paypal.com/paypalme/amr396
Source: https://www.tutorialexample.com/python-record-audio-from-computer-speaker-on-win-10-python-tutorial/