bastibe / SoundCard

A Pure-Python Real-Time Audio Library
https://soundcard.readthedocs.io
BSD 3-Clause "New" or "Revised" License
680 stars 69 forks source link

How to record from speaker? #91

Closed PasaOpasen closed 4 years ago

PasaOpasen commented 4 years ago

Can I record sounds from speakers?

Used code like this

record some music from speaker

data = default_speaker.record(samplerate=48000, numframes=48000)

repeat it

default_speaker.play(data/numpy.max(data), samplerate=48000)

janleskovec commented 4 years ago

When getting the recording devices with sc.all_microphones(), you can set the flag include_loopback like so: sc.all_microphones(include_loopback=true). This will include monitor devices on linux and loopback devices on windows. This is not supported on macOS.

PasaOpasen commented 4 years ago

thank u, I will try!