Various code and utilities extending other live streaming programs for Windows and Linux.
Adds a new Macro action to Advanced Scene Switcher that will play an audio file.
Dependencies: Pydub
(+ ffmpeg or libav for non-wav files.)
pip install pydub
apt-get install ffmpeg libavcodec-extra
Download the Python script from this repository from the SceneSwitcher directory to a location on your device.
Tools ▸ Scripts ▸ 'Add Scripts' + button ▸ adv-ss-sound.py
Click 'Scripts' in the Tools
menu of OBS Studio's main window.
In the window that opens, click the button to add a script, then browse to the .py file you saved. OBS will load this file at startup.
Then just open Advanced Scene Switcher from the Tools menu from before. The new Macro action will show up as "Sound".
Specify a full path to the audio file, or use the Browse button to open the file manager and locate your file of choice.
[mandatory] This tells Pydub's play method what filetype the file is. Usually this will match the file extension, so put that here. Failing to correctly provide this will generate an error.
If you are using an externally-managed environment with Python, you may need to modify the code to include the path to your Python modules.
Add in the top section, before importing Pydub:
import os
import sys
home = os.path.expanduser("~")
modules = os.path.join(home, ".venv/<my-env-here>/lib/<my-py-version>/site-packages")
if modules not in sys.path:
sys.path.append(modules)
[...]
Create a venv : python -m venv /path/to/new/virtual/environment
Activate : . ~/.venv/env/bin/activate
Installing modules : python -m pip install pip --upgrade