Pyrogram bot to automate streaming music in voice chats

Related tags

Audiovcpb
Overview

Pyrogram bot to automate streaming music in voice chats

Help

If you face an error, want to discuss this project or get support for it, join it's group on Telegram.

Requirements

  • A computer (a Debian-based Linux recommmended).
  • An alt Telegram account.
  • Bot token from @BotFather.
  • API ID & hash from my.telegram.org.
  • Python 3.6 or newer & latest version of pip.
  • MPV (and libmpv).
  • A software to forward audio to tdesktop (Linux: pulseaudio, Windows: voicemeeter).

Deploying

The code

Cloning

    git clone https://github.com/rojserbest/vcpb.git vcpb && cd vcpb

Configuring

CLI args (when running bot.py)

Example:

python3 bot.py \
--api-id 1 \
--api-hash abcdef1234 \
--token 1234567890:ABCDEF \
--sudo-users 111111_22222_33333 \
--mongo-db-uri mongodb+srv://user:[email protected]/vcpb \
--group -1001876543112 \
--dur-limit 10 \
--lang en
Config file

Copy config/sample_config.py to config/config.py and make it use your credentials (you can also give those as an arg when running bot.py):

API_ID int: your api id from my.telegram.org

API_HASH str: your api hash from my.telegram.org TOKEN str: your bot token from @BotFather

SUDO_USERS list(int): a list of user ids which can pause, skip and change volume

MONGO_DB_URI str: your MongoDB URI (you can get one for free in their official website, sign up, create a cluster and a database named "vcpb")

GROUP int: the id of the group where your bot plays (not required if both USERS_MUST_JOIN and LOG are false)

USERS_MUST_JOIN bool: if true, only users which are in the group can use the bot

LOG bool: if true, now playing messages will be sent to the group

LANG str: your bot language, choose an available language code in strings/

DUR_LIMIT int: max video duration in minutes for downloads

PIP requirements

pip(3) install -U -r requirements.txt

Running

⚠️ Warning for Linux users: don't run any command as root (except those which require it), else you might face bulky problems. You can create a user with adduser music and add it to sudoers using sudo usermod -aG sudo music.

ℹ️ The volume command isn't working on Windows.

On Linux VPS

These are apt package manager instructions but you can install the required packages with other package managers too.

  1. Update and upgrade apt: sudo apt update && sudo apt upgrade -y

  2. Install requirements: sudo apt install python3-pip xrdp pulseaudio mpv libmpv-dev screen -y

  3. Download tdesktop: cd ~ && wget https://telegram.org/dl/desktop/linux -O tdesktop.tar.xz && tar -xf tdesktop.tar.xz && rm tdesktop.tar.xz

  4. Configure XRDP session to only start Telegram: echo "~/Telegram/Telegram" >~/.xsession

  5. Enable pulseaudio service (you can skip this step if you don't have systemctl): systemctl --user enable pulseaudio

  6. Restart the machine: sudo reboot

  7. Start pulseaudio (you can skip this step if you did step 5): pulseaudio --start

  8. Go back to directory of the clone and load a pulseaudio null sink, by running: bash pa.sh

  9. Make a screen for the bot and attach to it: screen -S vcbot

  10. Run the bot: python(3) bot.py

  11. Detattach from the screen by pressing CTRL+A then CTRL+D.

  12. Open a remote desktop client and login to your user.

  13. You should see the Telegram GUI, just login, join a voice chat and set VoiceChatPyroBot as your microphone.

  14. Done, you can now start sending commands to your bot and it'll stream in the voice chat.

On Linux desktop

These are apt package manager instructions but you can install the required packages with other package managers too.

  1. Update and upgrade apt: sudo apt update && sudo apt upgrade -y

  2. Install requirements: sudo apt install pulseaudio mpv libmpv-dev pavucontrol screen -y

  3. If you have Telegram skip this step, otherwise download it here.

  4. Go to directory of the clone and load a pulseaudio null sink, by running: bash pa.sh

  5. Make a screen for the bot and attach to it: screen -S vcbot

  6. Run the bot: python(3) bot.py

  7. Detattach from the screen by pressing CTRL+A then CTRL+D.

  8. Open Telegram, join a voice chat and set VoiceChatPyroBot as your microphone.

  9. Done, you can now start sending commands to your bot and it'll stream in the voice chat.

On Windows 10 PC

  1. Download Voicemeeter here and install it.

  2. Download virtual audio cable here and install it.

  3. Reboot.

  4. Right click the speaker account in your taskbar, then click playback.

  5. Set Voicemeeter input and Voicemeeter output as default and click OK.

  6. Download MPV.

  7. Start Voicemeeter engine.

  8. Run the bot: python bot.py

  9. Open Telegram, join a voice chat and set Voicemeeter input as your microphone.

  10. Done, you can now start sending commands to your bot and it'll stream in the voice chat.

Usage

Streaming YouTube videos

  1. Open YouTube in your browser, and search for a song.
  2. Copy the complete video URL to clipboard and send it to your bot in private.

Method 2

  1. Enable inline for you bot in @BotFather.
  2. In your bot's private, type @usernameOfYourBot followed by your YouTube search query, and click a result.

Authors & Acknowledgment

Inspiration

Development & contribution

The venturimeter works on the principle of Bernoulli's equation, i.e., the pressure decreases as the velocity increases.

The venturimeter works on the principle of Bernoulli's equation, i.e., the pressure decreases as the velocity increases. The cross-section of the throat is less than the cross-section of the inlet pi

Shankar Mahadevan L 1 Dec 03, 2021
PyAbsorp is a python module that has the main focus to help estimate the Sound Absorption Coefficient.

This is a package developed to be use to find the Sound Absorption Coefficient through some implemented models, like Biot-Allard, Johnson-Champoux and

Michael Markus Ackermann 8 Oct 19, 2022
Audio pitch-shifting & re-sampling utility, based on the EMU SP-1200

Pitcher.py Free & OS emulation of the SP-12 & SP-1200 signal chain (now with GUI) Pitch shift / bitcrush / resample audio files Written and tested in

morgan 13 Oct 03, 2022
python wrapper for rubberband

pyrubberband A python wrapper for rubberband. For now, this just provides lightweight wrappers for pitch-shifting and time-stretching. All processing

Brian McFee 106 Nov 28, 2022
TONet: Tone-Octave Network for Singing Melody Extraction from Polyphonic Music

TONet Introduction The official implementation of "TONet: Tone-Octave Network for Singing Melody Extraction from Polyphonic Music", in ICASSP 2022 We

Knut(Ke) Chen 29 Dec 01, 2022
Multi-Track Music Generation with the Transfomer and the Johann Sebastian Bach Chorales dataset

MMM: Exploring Conditional Multi-Track Music Generation with the Transformer and the Johann Sebastian Bach Chorales Dataset. Implementation of the pap

102 Dec 08, 2022
OpenClubhouse - A third-part web application based on flask to play Clubhouse audio.

OpenClubhouse - A third-part web application based on flask to play Clubhouse audio.

1.1k Jan 05, 2023
Official implementation of A cappella: Audio-visual Singing VoiceSeparation, from BMVC21

Y-Net Official implementation of A cappella: Audio-visual Singing VoiceSeparation, British Machine Vision Conference 2021 Project page: ipcv.github.io

Juan F. Montesinos 12 Oct 22, 2022
Telegram Voice-Chat Bot Written In Python Using Pyrogram.

Telegram Voice-Chat Bot Telegram Voice-Chat Bot To Play Music From Various Sources In Your Group Support All linux based os. Windows Mac Diagram Requi

TheHamkerCat 314 Dec 29, 2022
FPGA based USB 2.0 high speed audio interface featuring multiple optical ADAT inputs and outputs

ADAT USB Audio Interface FPGA based USB 2.0 High Speed audio interface featuring multiple optical ADAT inputs and outputs Status / current limitations

Hans Baier 78 Dec 31, 2022
Tune in is a Collaborative Music Playing Systems where multiple guests can join a room and enjoy the song being played

✨A collaborative music playing systems🎶 where multiple guests can join a room ➡🚪 and enjoy the song🎧 being played.

Vedansh Vijaywargiya 8 Nov 05, 2022
Mousai is a simple application that can identify song like Shazam

Mousai is a simple application that can identify song like Shazam. It saves the artist, album, and title of the identified song in a JSON file.

Dave Patrick 662 Jan 07, 2023
Audio augmentations library for PyTorch for audio in the time-domain

Audio augmentations library for PyTorch for audio in the time-domain, with support for stochastic data augmentations as used often in self-supervised / contrastive learning.

Janne 166 Jan 08, 2023
pedalboard is a Python library for adding effects to audio.

pedalboard is a Python library for adding effects to audio. It supports a number of common audio effects out of the box, and also allows the use of VST3® and Audio Unit plugin formats for third-party

Spotify 3.9k Jan 02, 2023
Sound-Equalizer- This is a Sound Equalizer GUI App Using Python's PyQt5

Sound-Equalizer- This is a Sound Equalizer GUI App Using Python's PyQt5. It gives you the ability to play, pause, and Equalize any one-channel wav audio file and play 3 different instruments.

Mustafa Megahed 1 Jan 10, 2022
Voice to Text using Raspberry Pi

This module will help to convert your voice (speech) into text using Speech Recognition Library. You can control the devices or you can perform the desired tasks by the word recognition

Raspberry_Pi Pakistan 2 Dec 15, 2021
An audio guide for destroying oracles in Destiny's Vault of Glass raid

prophet An audio guide for destroying oracles in Destiny's Vault of Glass raid. This project allows you to make any encounter with oracles without hav

24 Sep 15, 2022
Muzic: Music Understanding and Generation with Artificial Intelligence

Muzic is a research project on AI music that empowers music understanding and generation with deep learning and artificial intelligence.

Microsoft 2.6k Dec 30, 2022
This is a realtime voice translator program which gets input from user at any language and converts it to the desired language that the user asks

This is a realtime voice translator program which gets input from user at any language and converts it to the desired language that the user asks ...

Mohan Ram S 1 Dec 30, 2021
Voicefixer aims at the restoration of human speech regardless how serious its degraded.

Voicefixer aims at the restoration of human speech regardless how serious its degraded.

Leo 324 Dec 26, 2022