You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
33 lines
1.0 KiB
import pymumble_py3 as pymumble_py3 |
|
from pymumble_py3.callbacks import PYMUMBLE_CLBK_SOUNDRECEIVED as PCS |
|
|
|
# Connection details for mumble server. Hardcoded for now, will have to be |
|
# command line arguments eventually |
|
pwd = "" # password |
|
server = "protospace.ca" # server address |
|
nick = "python" |
|
port = 64738 # port number |
|
|
|
audio_file = open('audio.wav', 'wb') |
|
|
|
# mumble client set up |
|
def sound_received_handler(user, soundchunk): |
|
""" play sound received from mumble server upon its arrival """ |
|
print(len(soundchunk.pcm)) |
|
|
|
audio_file.write(soundchunk.pcm) |
|
|
|
# Spin up a client and connect to mumble server |
|
mumble = pymumble_py3.Mumble(server, nick, password=pwd, port=port) |
|
# set up callback called when PCS event occurs |
|
mumble.callbacks.set_callback(PCS, sound_received_handler) |
|
mumble.set_receive_sound(1) # Enable receiving sound from mumble server |
|
mumble.start() |
|
mumble.is_ready() # Wait for client is ready |
|
|
|
# constant capturing sound and sending it to mumble server |
|
try: |
|
while True: |
|
pass |
|
finally: |
|
audio_file.close()
|
|
|