Sample code which records system sounds (what you hear) in Python.
This worked on Windows 10/11 and Ubuntu 18.04.
- Clone this repository
- Go to the the directory you have just cloned
- On Linux, you need to install libsndfile using your distribution’s package manager like apt in order to use SoundFile library
- Run the following command (On Windows, I recommnend using the current master branch of SoundCard because the released SoundCard has a bug related to Windows. Check this issue I opend for more infomation.)
pip install -r requirements.txt
- Before running the program, start outputting sound from the device`s speaker or headphones so that the program can record that sound.
- Run the program as below.
python capture.py
- After seconds, the program produces an audio file named out.wav.
- Check if the program could record system sounds by playing out.wav.