A simple Processing/java template for collective "music" performances over Twitch. It creates a chatbot that connects to your Twitch channel and lets users interact with your computer through text commands like:
delay 90 2 - changes the controller labeled "delay" to 90% over the course of 2 seconds dropbass - sends a C2 note
TwitchPlaysMIDI was created for TwitchPlaysBees. It controlled two VST filters in Ableton Live. The VST filters windows were on a second display with a green background and overlayed on the stream with a chroma key effect.
-
Requires Processing a free Java-based environment for creative coding.
-
Uses PircBot an IRC library for java (included in code/)
-
Uses The MidiBus a Processing library (not included)
-
Uses Ani a Processing library that manages eased transitions between values
Traditionally Twitch-plays games run on dedicated machines that are streaming the output of the game through OBS or other applications. This program listens to Twitch chat messages and interprets them as MIDI input on your computer. A Twitch chat mostly functions like an IRC channel, so your bot can both receive or send text messages. You need some familiarity with MIDI configuration to set this up.
- Open the project in Processing making sure that all the files are in a folder named TwitchPlaysMidi (not TwitchPlaysMidi-master).
- Add your Twitch credentials to Bot.pde. If "irc.twitch.tv" in Bot.pde doesn't connect try "irc.chat.twitch.tv"
- Install The MidiBus and Ani libraries from Processing with Add Library...
- Set up your virtual MIDI bus/port. On Window you will need a Virtual Midi Cable program like loopMIDI (launch, add port with the +). On Mac you need to follow these instructions
- Run the sketch check the list of MIDI device and replace "loopMIDI Port" in TwitchToMidi.pde with the device you want to use.
- Set up your music making program (DAW) and map the controls you want to expose to remote MIDI. This configuration depends on the application. Examples: Ableton Live, FL Studio...
- In TwitchPlaysMidi.pde add your own chat commands and related MIDI controllers in the arraylist "controllers"
- Test the Twitch to MIDI communication first and then the MIDI to DAW communication. You don't have to be live on Twitch to test the chat functionalities, just open your offline channel and type in the chat.
- Start streaming
- ???
- Profit!
-
This program doesn't create any music, it only produces MIDI inputs emulating a keyboard or a controller. You will need a MIDI-enabled digital audio workstation like Ableton Live, Garage Band, or FL Studio to turn notes into sound.
-
On Twitch there is a lag of a couple of seconds between video and chat, don't expect users to be in sync or to make meaningful compositions. TwitchPlaysMIDI is probably more appropriate for hybrid performances in which users contribute to a live set, slow ambient pieces, or generative music.
-
Twitch hides the channel description at the bottom of the page so users don't generally see the instructions. Consider setting up a stream overlay with some information on how to interact. You can use Processing's graphical capabilities for that.