Skip to content

squidud/drum-stream-chat-queue

Repository files navigation

Drum Stream Chat Queue

A YouTube live stream song request queue system with drum removal processing and OBS overlay support.

Features

  • Monitors YouTube live chat for song requests
  • Downloads and processes songs (removes drums using Demucs)
  • Queue management GUI with playback controls
  • Real-time queue overlay for OBS (works across different computers)
  • Firebase sync for remote queue display

System Requirements

  • Python 3.8+
  • PyTorch (with MPS support for Apple Silicon, or CPU)
  • Internet connection for YouTube and Firebase

Setup

1. Install Dependencies

pip install -r requirements.txt

2. Set Up Firebase (for OBS Overlay)

For production use, follow the detailed guide: FIREBASE_SETUP.md

Quick setup with config file (easiest):

  1. Go to Firebase Console
  2. Create a new project (or use existing)
  3. In the project, go to Realtime Database (not Firestore)
  4. Click Create Database → choose your region → Start in locked mode (for production)
  5. Download service account (see FIREBASE_SETUP.md Step 4)
  6. Copy firebase_config.json.example to firebase_config.json:
    cp firebase_config.json.example firebase_config.json
  7. Edit firebase_config.json with your values:
    {
      "firebase_url": "https://your-project-default-rtdb.firebaseio.com",
      "service_account_path": "firebase-service-account.json"
    }

Alternative: Use environment variables (see FIREBASE_SETUP.md)

3. Configure YouTube Channel

Edit chatops.py and change the channel URL on line 21:

channel_url = "https://www.youtube.com/@yourchannel"

Or configure it in the GUI after launching.

Running the Application

Queue Computer (Main Application)

  1. Make sure FIREBASE_URL environment variable is set
  2. Run the GUI:
python gui.py

The application will:

  • Connect to the YouTube live chat
  • Listen for /request <song name> commands
  • Download and process songs (remove drums)
  • Sync queue state to Firebase in real-time

OBS Computer (Overlay Display)

See the obs_computer/README.md file for detailed setup instructions.

Quick setup:

  1. Copy the obs_computer folder to your OBS computer
  2. Edit overlay.html and set your FIREBASE_URL
  3. In OBS, add a Browser source pointing to overlay.html
  4. Position and style as needed

Usage

Chat Commands

Users in the YouTube live chat can request songs by typing:

/request song name or artist

For example:

/request Never Gonna Give You Up
/request Rick Astley

GUI Controls

  • Processing Queue: Shows songs being downloaded/processed
  • Ready Queue: Songs ready to play
    • Reorder with "Move Up"/"Move Down" buttons
    • Delete unwanted songs
  • Now Playing: Current song with playback controls
  • Add Manual Request: Add songs without chat command
  • Keep file after playing: Check to preserve processed audio files

File Structure

temp_music/     # Downloaded audio (temporary)
output_music/   # Processed audio (drums removed)
obs_computer/   # OBS overlay files

Customization

Overlay Styling

Edit obs_computer/overlay.html - all styles are in the <style> section at the top. You can customize:

  • Colors and transparency
  • Fonts and sizes
  • Layout and spacing
  • Animations (add your own CSS animations!)

Processing Settings

Edit songprocessor.py to adjust:

  • Demucs model (line 13)
  • Audio quality settings
  • Output format

Troubleshooting

Firebase Not Updating

Problem: Overlay shows "No songs" even when queue has items

Solutions:

  • Verify FIREBASE_URL is set correctly on both computers
  • Check Firebase Console → Realtime Database to see if data is being written
  • Look for error messages in the terminal/console
  • Make sure Firebase database rules allow read/write (test mode)

Chat Not Connecting

Problem: "No live stream found" error

Solutions:

  • Make sure the channel has an active live stream
  • Verify the channel URL is correct
  • Check your internet connection
  • YouTube may be rate-limiting - wait a few minutes and retry

Playback Issues

Problem: Songs don't play or skip immediately

Solutions:

  • Check that files exist in output_music/ folder
  • Try different audio formats (edit songprocessor.py)
  • Verify PyQt5 multimedia components are installed correctly

Firebase Connection Errors

Problem: "Failed to update Firebase" messages

Solutions:

  • Check internet connection on queue computer
  • Verify Firebase URL is correct (should end with .firebaseio.com)
  • Check Firebase Console for any outages
  • Ensure requests library is installed: pip install requests

Network Considerations

This system works across networks because:

  • Both computers connect to Firebase (cloud service)
  • No direct connection between computers needed
  • Works on restricted networks (like schools) that allow HTTPS
  • Firebase handles all the real-time synchronization

Latency: Typically 50-200ms for updates to appear on OBS overlay.

Security Notes

For production use, you MUST set up proper authentication!

See FIREBASE_SETUP.md for complete production setup instructions including:

  • Service account authentication
  • Secure Firebase rules
  • Best practices for protecting credentials

The quick test mode setup is only for testing - anyone can read/write your database in test mode!

Credits

  • Demucs: Audio source separation by Facebook Research
  • pytchat: YouTube live chat library
  • yt-dlp: YouTube download library

License

MIT License - feel free to modify and use for your streams!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published