0

I tried to record audio with this code:

import sounddevice
from scipy.io.wavfile import write
fs = 44100
second = 3
file = sounddevice.rec(int(second * fs), samplerate=fs, channels=2)
sounddevice.wait()
write('output.wav', fs, file)

but it only records output of mic while i want to record system media sound

meysam
  • 1

1 Answers1

0

Most operating systems do not offer default output as source to record. You need to do use audio routing tools to archive that.

For example, in MacOS, one could install a tool called Soundflower or some later alternatives. Then on OS level, send all output to that soundflower "device" and then you would be able to record those after you select that soundflower device as the source via; https://python-sounddevice.readthedocs.io/en/0.4.5/usage.html#device-selection

On Linux, JACK probably can do the same as MacOS soundflower counterpart. On Windows, no idea...

rasjani
  • 7,372
  • 4
  • 22
  • 35