pyalsaaudio
pyalsaaudio copied to clipboard
PCM stuttering
Hi guys. I was trying to make a simple mumble client. I wrote the basics but the audio i get stutters a lot. The code follows:
import pymumble_py3
from pymumble_py3.callbacks import PYMUMBLE_CLBK_SOUNDRECEIVED as PCS
import alsaaudio as a
# Mumble server connection Settings
password = ""
server = "192.168.1.61"
username = "Pi"
port = 64738
# Audio stream settings
CHUNK = 5000
DATATYPE = 'int16'
CHANNELS = 1
RATE = 48000
# Inistialize the audio stream using devices
# This part is about the connection to the Mumble Server
# Setting
device = 'hw:CARD=PCH,DEV=0'
out = a.PCM(a.PCM_PLAYBACK, channels=1, rate=48000, format=a.PCM_FORMAT_S16_LE, periodsize=32,
device=device, mode=a.PCM_NONBLOCK)
def sound_received_handler(user, soundchunk):
out.write(soundchunk.pcm)
pass
mumble = pymumble_py3.Mumble(server, username, password=password, port=port)
mumble.callbacks.set_callback(PCS, sound_received_handler)
mumble.set_receive_sound(1)
mumble.start()
mumble.is_ready()
while True:
pass
thanks for your patience