-
Notifications
You must be signed in to change notification settings - Fork 10
Closed
Description
soxbinding works great in one thread, but it looks like it consistently fails when multithreading. Minimal example below. Note that any effect (.vol, .compand, .trim, etc) triggers the same error. Running this with command line sox (replacing import soxbindings as sox with import sox) works fine.
from multiprocessing.dummy import Pool as ThreadPool
import numpy as np
import soxbindings as sox
y1 = np.zeros((4000, 1))
y2 = np.zeros((3000, 1))
def do_transform(y):
tfm = sox.Transformer()
tfm.vol(0.5)
y_out = tfm.build_array(input_array=y, sample_rate_in=1000)
return y_out
# single thread
print("running single thread")
for y in [y1, y2]:
res = do_transform(y)
print(res.shape)
# multithread
print("running multi thread")
pool = ThreadPool(2)
results = pool.map(do_transform, [y1, y2])Output:
running single thread
(4000, 1)
(3000, 1)
running multi thread
Assertion failed: (fft_len == -1), function init_fft_cache, file effects_i_dsp.c, line 170.
Abort trap: 6
Metadata
Metadata
Assignees
Labels
No labels