Recording loopback using Blackhole on python

190 Views Asked by At

import soundcard as sc
import soundfile as sf

default_mic = sc.get_microphone('BlackHole 2ch')

OUTPUT_FILE_NAME = "out1.wav"    # file name.
SAMPLE_RATE = 44100             # [Hz]. sampling rate.
RECORD_SEC = 15                  # [sec]. duration recording audio.


with default_mic.recorder(samplerate=SAMPLE_RATE) as mic:
    data = mic.record(numframes=SAMPLE_RATE * RECORD_SEC)

sf.write(file=OUTPUT_FILE_NAME, data=data, samplerate=SAMPLE_RATE)

Loopback recording of my computer's internal audio but I got wav file containing any audio information Hey guys, I am trying to record my computer's internal audio with using python and blackhole(virtual soundcard) on MacOS. I already selected my output/input as Blackhole and script works and creates this out.wav file. Yet, it does not contain any audio information and I couldn't find out why. I am beginner at programming so maybe I am skipping important stuff

0

There are 0 best solutions below