Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/usr/bin/env python3
import time, math, threading, struct, sys, os.path, random
import obswebsocket, obswebsocket.requests
client = obswebsocket.obsws("localhost", 4444)
client.connect()
source_patterns = [
"RTMP", "JACK", "AUX"
]
sources = client.call(obswebsocket.requests.GetCurrentScene()).getSources()
audio_sources = [source["name"] for source in sources if any(i in source["name"] for i in source_patterns)]
while True:
#time.sleep(random.uniform(0, 0.1))
source = random.choice(audio_sources)
mode = random.choice(("monitorAndOutput", "monitorOnly", "none"))
x = client.call(obswebsocket.requests.SetAudioMonitorType(source, mode))
print(x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment