vladkorotnev / traktor-obs-relay

Small Traktor widget template/engine for OBS in Rust and HTML/JS
MIT License
27 stars 3 forks source link
obs streaming traktor

traktor-obs-relay

A tiny Traktor-API-Client server for use on live streams.

P.S. Features like artwork or subtitle retrieval assume the server is running on the same host as Traktor for now.

Demo video

Have a look at the DJ Set Showcase of this software!

Core architecture

The executable itself only acts as a state store, tiny web server and an event bus in one thing.

It also "demuxes" track and deck events, combining them together to effectively figure out what tracks are hearable to the listeners. Thus, a playing deck won't affect the widgets if it's closed behind the Xfader or the channel fader.

Clients can then poll the host executable on /nowPlaying or get the same update data on most major events via websocket.

There is a simple JavaScript client layer implemented under assets/api which will, when loaded into a page, execute the following functions in the page context:

How to build

Just use the usual Rust workflow (cargo build or cargo run).

How to set up

Config explanation

HTTP section

Mixing section

Exposed endpoints

Aside from the usual endpoints from Traktor-API-Client, the HTTP host also provides the following URLs:

About the bundled widgets

The widgets bundled are what I use on my own streams. While they can be used as-is, I strongly encourage you to take some time and come up with something unique to give your sessions more personality! Or even share some of your ideas through a pull-request :-)

bpm.html

Shows an animated realtime BPM counter, attached to the MASTER CLOCK of Traktor. Requires the DSEG font to be installed on your computer.

bpm_headbang.html

Displays a headbanging gif animation from a sprite sheet located in headbanger.png, adjusted to the master BPM. Demo video

column.html

Displays an animated "Previously Played" tracklist column. Recommended to place this on the left side of the stream (see demo).

lower_third.html

Displays the currently played songs. Recommended to place this as the lower section of the image.

lower_third_artwork.html

Same, but displays album art next to the track names (see demo).

video-intro.html

Place this as a fullscreen overlay over your stream. Place video.mp4 into the assets folder (NB: Unlike all other resources, it's not included, so won't work right away!).

The stream video will become dark. When you start your first song in Traktor, video.mp4 will play. Once video.mp4 ends playing, your stream layout is visible. It's recommended to use a video with transparency to create a less abrupt transition into the set.

subtitle.html

Based upon the JavascriptSubtitlesOctopus library.

Place this as a fullscreen overlay over your stream. It will play subtitle files to your songs (Advanced Substation Alpha, a.k.a. ASS format) on the first played, first shown basis. This is probably resource-heavy so don't go too hard on adding that vintage fansub karaoke flair with half a dozen animations per symbol!

auto-vj.html

Plays video files stored by the same name as the played audio files automatically. Not guaranteed to be 100% in sync for obvious reasons. Supports webm and mp4 with opacity.

auto-vj-uri.html

Plays video files by the same name as the played audio files automatically pointed to a specific URI without needing to download the whole file so it loads really fast, useful when the relay is hosted into another computer and files need to be accessed locally or from any other host. Web server must support ranges by default, nginx is recommended. Supports webm and mp4 with opacity. This version of auto-vj uses more RAM but it's way smoother and prevents browser lag and freezing. To configure the URI edit /assets/auto-vj-uri.html and set the LOCAL_URI constant.

logger.html

Creates a timecode log. Open it in your browser (not in OBS!) before you start your set to have a timecode list ready for copying into YouTube video descriptions or Mixcloud timestamps. You can also filter played songs by duration to ignore samples, choose whether you want to timestamp based on introducing a track into the mix or when the track goes solo, and offset the whole list by a number of seconds to align with the video/audio file.

vfd.html

A driver for the CD7220-based 2x20 VFD character displays, usually found in POS system customer displays (aka "cashier's display").

Open it in the browser (not in OBS!), click "Connect" and select a serial port the display is connected to.

Whenever a new track is played (goes solo), the display will show a small intro animation and transition into showing a scrolling track title along with the artist name.

VFD channel in ASS subtitles

The VFD driver also checks for presence of subtitles same as subtitle.html does. If subtitles are found, it loads them and processes the lines that are up to the following conditions:

Other lines are ignored, so it's safe to combine on-screen subtitles and VFD subtitles in a single file.


by akasaka, 2021~2023