Skip to content

JhonZeng/obs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 

Repository files navigation

This is a piece of Python code to help bloggers who use obs for outdoor live broadcasts encounter copyright issues when outdoor music accidentally enters the scene. It monitors specific audio input ports on macOS using "pyaudio" and "librosa". When music is detected, it sends a command to OBS via the WebSocket API to switch the audio source and play a tone to replace the sound in the audio input source. And when the music detects that the music is over, it automatically switches back to the original audio source. When the program is running, it continuously loops to detect the audio in the current audio input source and waits for input instructions. When the "start" command is entered, the program starts executing the listening task. When the "stop" command is entered, the program returns to standby state. When the "exit" command is entered, all ports are closed and the program is shut down.

Working principle: This script continuously monitors the audio input stream for the specified input port on macOS. When it detects that the musical content in the audio exceeds the threshold based on the RMS value, it will send a command to OBS to switch the audio source and play a prompt tone to replace the ambient microphone audio to prevent YouTube live broadcast from encountering music copyright issues. The user determines the value of the threshold parameter through debugging, and controls the sensitivity of the program to detect music and cut off live audio. It also waits for user input commands and processes them accordingly.

Note: In order to run offline as much as possible to reduce network expenses, the program chose the librosa library for music melody detection. This library is a commonly used library for melody detection, but its robustness in dealing with complex situations is not as robust as the Transformer model or LSTM based Model of Recurrent Neural Network (RNN). Therefore, in some cases, we recommend that users equip the OBS with a Bluetooth remote control to perform manual backup.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages