Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to record internal audio? Python

I would like to know if it is possible to record internal audio using a python library, since many of the codes found on the internet and stackoverflow, are related to recording the audio from the microphone and not directly from the speakers (perhaps the soundcard). For example, you are on a Skype call and want to record that call using python (not the microphone input).


I tried to use a library in development called SoundCard, however I get an error.

import soundcard as sc

# get a list of all speakers:
speakers = sc.all_speakers()

# get the current default speaker on your system:
default_speaker = sc.default_speaker()

Traceback:
default_speaker = sc.default_speaker()
AttributeError: partially initialized module 'soundcard' has no attribute 'default_speaker' (most likely due to a circular import)
like image 961
Y4RD13 Avatar asked May 01 '26 21:05

Y4RD13


1 Answers

I'd recommend checking out pyaudio, I haven't used it to record but it's a great library.

This blog post has details on how to use it to record.

like image 85
GarAust89 Avatar answered May 04 '26 11:05

GarAust89



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!