Swaps active audio input device in OBS upon twitch chat channel point redemption.

Overview

OBS-Mic-Swapper

Shortcuts



Set up

  1. Create an account on Twitch for your bot
  2. Make sure your OBS version is >= 28.0.0.

If not, install OBS Websocket here

  1. Install the node modules for this program.
  2. Provide the OAuth data from your bot account in /twitch/client.json and /twitch/tokens.json
  3. Fill in the websocket authentication details in /twitch/auth.json
  4. Change the CHANNEL and REWARD to your channel and your reward ID in /twitch/listener.js.
  5. Make sure the values of MIC and CAM matches the names of the two OBS audio sources you want the script to mute/unmute.

You can edit how long the toggle should last for by changing TIMEOUT

  1. Now run the program

Important: OBS needs to be open in order for the script to connect to the websocket

If you don't want to launch this manually each time you start your OBS, check this out.



Program Description

The system contains two main parts, one interacting with OBS and the other one interacting with Twitch Chat.

The OBS part

The system connects to your OBS locally using OBS Websocket.
The connection to OBS is only first established upon a call from the other part, the twitch chat listener.

The Twitch part

The listener connects to twitch chat as a read only bot that listens for specific custom channel point rewards redeemed by chatters.
This part is active at all times when the program is running and executes the OBS part when the channel point reward has been redeemed.



Example of Functionality

A user redeems the custom channel point reward "Mute Mic for 10s". This projects listener sees this reward in chat and tells the OBS part of the system to launch.
The OBS websocket client starts and tries to connect to OBS Websocket. When connected, the audio state (muted/not muted) of the two input devices gets toggled. After 10 seconds, the input devices audio state gets once again toggled and returns to it's prior state.



FAQ

How to find the reward ID?

You can check what the ID is by uncommenting line 37 before starting the program again. Keep in mind that the reward needs to have a text input field in twitch chat.


How do I install the correct node modules?

If you already have Node.js installed, simply navigate your command line to the root of this project where you can find package.json and run npm install


How do I run the program?

You will need to have Node.js installed to execute the program in a command line or via a .bat file or similar. The program can only be connected to OBS websockets on the same network as where the script is running.

Start by navigating your command line to the root folder of this system where you can find index.js. Now launch the program using one of the following

npm start

or

node ./index.js

Leave it open throughout your stream.


Can I run this automatically when starting OBS?

By default, no. Perhaps you can! I personally have not looked into this too much, but maybe this can be of some help?



Contact

Questions? Reach me on Twitter or Discord!

Twitter Logo            Discord Logo

You might also like...

Navigation-Menu-Javascript - A simple Navbar navigation using vanilla javascript, to change links to the active link when clicked.

Navigation-Menu-Javascript - A simple Navbar navigation using vanilla javascript, to change links to the active link when clicked.

Navigation-Menu-Javascript A simple Navbar navigation using vanilla javascript, to change links to the active link when clicked. Desktop view Mobile v

Feb 16, 2021

JavaScript Express.js app serving static vanilla JS. This sample app is used in Microsoft Docs to demonstrate how to integrate Azure Storage, Azure Cosmos DB, and Azure Active Directory.

JavaScript on Azure Learn Path - Module 2 - Deploying a basic app to Azure This Learn module requires the following Azure resources to deploy correctl

Dec 31, 2022

A quick and easy to use security reconnaissance webapp tool, does OSINT, analysis and red-teaming in both passive and active mode. Written in nodeJS and Electron.

A quick and easy to use security reconnaissance webapp tool, does OSINT, analysis and red-teaming in both passive and active mode. Written in nodeJS and Electron.

ᵔᴥᵔ RedJoust A quick and easy to use security reconnaissance webapp tool, does OSINT, analysis and red-teaming in both passive and active mode. Writte

Oct 31, 2022

A file sharing service, where you can upload files and provide a download link for anyone on the internet by sharing the link 🔗 or via mail ✉️ which remains active for 24hours 🕙.

eShare | File Sharing App A file sharing service, where you can upload files and provide a download link for anyone on the internet by sharing the lin

Nov 20, 2022

Add grouped tabsets, which remember the active tab across multiple HTML documents.

Grouped Tabsets See the extension in action. This quarto extension provides support for "grouped" tabsets in Quarto HTML documents. Consider the case

Sep 30, 2022

A fast and powerful http toolkit that take a list of domains to find active domains and other information such as status-code, title, response-time , server, content-type and many other

A fast and powerful http toolkit that take a list of domains to find active domains and other information such as status-code, title, response-time , server, content-type and many other

HTTPFY curently in beta so you may see problems. Please open a Issue on GitHub and report them! A Incredible fast and Powerful HTTP toolkit Report Bug

Dec 22, 2022

Chat View let's you quickly and easily create elegant Chat UIs in your Markdown Files.

Chat View let's you quickly and easily create elegant Chat UIs in your Markdown Files.

Obsidian Chat View Plugin Chat View let's you quickly and easily create elegant Chat UIs in your Markdown Files. Usage Every chat message must be pref

Dec 27, 2022

Omnichannel Live Chat Widget UI Components offers a re-usable component-based library to help create a custom chat widget that can be connected to the Dynamics 365 Customer Service experience.

Omnichannel Live Chat Widget UI Components @microsoft/omnichannel-chat-widget is a React-based UI component library which allows you to build your own

Dec 15, 2022

Replaces Youtube Chat with Destiny.gg chat.

Replaces Youtube Chat with Destiny.gg chat.

A lightweight extension that replaces the native Youtube Live chat with an embeded destiny.gg chat. Note: This is in no way affiliated with Destiny.gg

Jul 27, 2022
Owner
Gothenburg 👨‍🎓 | Software Engineering and Management BSc 💻
null
automatic poits grabber for twitch, works with all supported langauges on twitch

Twitch Points Grabber It’s an extension for edge, is aviable in the microsoft Edge Add-ons. This extension will collect any channel points. Settings I

Claudio Menegotto 3 Nov 28, 2022
Do you wanna improve your Twitch chat interactivity? Hold my beer.

OpenTwitch ???? O que é a OpenTwitch? A OpenTwitch é uma aplicação NodeJS desenvolvida ao vivo na twitch com o objetivo principal de fazer uma solução

Jhonatan Junio 40 Dec 28, 2022
Integrate Railway Project events with Telegram Chat/Channel using Railway Webhooks

Railway to Telegram Integrate Railway Project events with Telegram Chat/Channel using Railway Webhooks! One Click Self Deploy Manual Self Deploy Fork

Agampreet Singh 9 Jul 5, 2022
Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript.

Device.js Device.js is a JavaScript library to detect device, viewport, and browser information using plain JavaScript. Compatibility Works with all m

Emanuel R. Vásquez 5 Dec 16, 2022
This plugin can generate timestamps for video, audio and Bilibili video, it takes you to the corresponding video/audio position when clicked.

logseq-plugin-media-ts 本插件能够生成视频、音频以及 B 站视频的时间戳,点击时间戳后会跳转到对应的音视频位置。 This plugin can generate timestamps for video, audio and Bilibili video, it takes

Seth Yuan 58 Jan 3, 2023
Essential Audio Player JS is a simple, clean and minimal JavaScript / HTML5 / CSS web audio player.

Essential Audio Player JS is a simple, clean and minimal JavaScript / HTML5 / CSS web audio player. No unnecessary controls, just a button and a track

null 32 Dec 14, 2022
🔐 Protect your Smart Contract Proxy from storage collisions upon upgrading, by running this action in a CI on each of your Pull Requests!

?? ??️ Foundry Storage Upgrade Seatbelt Protect your Smart Contract Proxy from storage collisions upon upgrading, by running this action in a CI on ea

Romain Milon 11 Dec 24, 2022
A Bootstrap plugin to create input spinner elements for number input

bootstrap-input-spinner A Bootstrap / jQuery plugin to create input spinner elements for number input. Demo page with examples Examples with floating-

Stefan Haack 220 Nov 7, 2022
A phone input component that uses intl-tel-input for Laravel Filament

Filament Phone Input This package provides a phone input component for Laravel Filament. It uses International Telephone Input to provide a dropdown o

Yusuf Kaya 24 Nov 29, 2022
A simple dashboard to keep track of all your active devices/servers

Slashboard Pulsar A lightweight node js app designed to work with the Slashboard desktop client Built using Node.js Installation Clone this repository

Philippe Négrel-Jerzy 25 Dec 21, 2022