I've been trying to make jackclient work (if possible) for a real-time audio processing application in python. You can see the code below:
import jack
import numpy as np
jclient = jack.Client("jclient")
jclient.register_port("in", jack.IsInput)
jclient.register_port("out", jack.IsOutput)
jclient.activate()
jclient.connect("system:capture_1","jclient:in")
for n_playback_port in (1, 2):
jclient.connect("jclient:out", "system:playback_{}".format(n_playback_port))
#sr = jclient.get_sample_rate()
buffer_size = jclient.get_buffer_size()
jcapture = np.zeros((1,buffer_size), 'f')
jinput = np.zeros((1,buffer_size), 'f')
joutput = np.zeros((1,buffer_size), 'f')
try:
while True:
print("Capturing audio")
try:
jclient.process(joutput, jcapture)
except jack.InputSyncError:
print("InputSyncError")
except jack.OutputSyncError:
print("OutputSyncError")
#process jcapture here
print("Playing back\n")
try:
jclient.process(jcapture, jinput)
except jack.InputSyncError:
print("InputSyncError")
except jack.OutputSyncError:
print("OutputSyncError")
except KeyboardInterrupt:
pass
The problem is that even if I don't process the signal at all (use the code above) and just playback the input I hear the input but with interrupts between the consecutive frames (buffers). Am I doing something wrong or is there a better way to do this?
I'm using 16000 kHz sample rate and 1024 samples buffer size for the jackd server.
Hello,
I've been trying to make jackclient work (if possible) for a real-time audio processing application in python. You can see the code below:
The problem is that even if I don't process the signal at all (use the code above) and just playback the input I hear the input but with interrupts between the consecutive frames (buffers). Am I doing something wrong or is there a better way to do this?
I'm using 16000 kHz sample rate and 1024 samples buffer size for the jackd server.