random/mumble-bot/silent-bot.py
2020-11-05 11:28:24 +01:00

34 lines
1 KiB
Python

import pymumble_py3 as pymumble
import subprocess as sp
from time import sleep
import sys
import os
import fcntl
import pyaudio
pwd = "" # password
server = "mumble.esiliati.org" # server address
nick = "TubiaBotSilente"
channel = "radiospore_onair"
port = 64738 # port number
# pyaudio set up
CHUNK = 1024
FORMAT = pyaudio.paInt16 # pymumble soundchunk.pcm is 16 bits
CHANNELS = 1
RATE = 48000 # pymumble soundchunk.pcm is 48000Hz
# Spin up a client and connect to mumble server
mumble = pymumble.Mumble(server, nick, password=pwd, port=port)
# set up callback called when PCS event occurs
mumble.set_receive_sound(0) # Enable receiving sound from mumble server
mumble.start()
mumble.is_ready() # Wait for client is ready
mumble.channels.find_by_name(channel).move_in()
#mumble.users.myself.mute()
# constant capturing sound and sending it to mumble server
while True:
mumble.sound_output.add_sound(bytes([0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00]))