I am not a Python expert so if I say something stupid here, do not be surprised. :)
I'm using the lines from the remix example in the documentation, and the first y_out line throws a mismatch dtype error, expecting float32, not int32.
y_out = librosa.effects.remix(y, intervals[::-1])
The y variable is float32, so that does not seem to be the issue. The intervals variable is int32, but I tried first converting it (with astype()) to float32 and that does not solve the error.
In the remix function in effects.py, lines 389-393 create a zeros variable (the condition is met because align_zeros is set to True by default in the remix function).
if align_zeros:
y_mono = core.to_mono(y)
zeros = np.nonzero(core.zero_crossings(y_mono))[-1]
# Force end-of-signal onto zeros
zeros = np.append(zeros, [len(y_mono)])
The resulting zeros variable is int32, which is where the problem seems to lie.
Then in lines 397-406 of effects.py, the util.match_events function is called, using the y and the zeros variables.
for interval in intervals:
if align_zeros:
interval = zeros[util.match_events(interval, zeros)]
clip[-1] = slice(interval[0], interval[1])
y_out.append(y[tuple(clip)])
y_out = np.asfortranarray(np.concatenate(y_out, axis=-1))
It gets deep into other modules at this point. Matching.py contains the match_events function, which needs an events_from parameter, which is y, and an events_to parameter, which is zeros. This seems to be where the error is thrown, because it must be expecting both the from and to parameters to be float32, and the to parameter (zeros) is int32. Maybe some of the other modules are supposed to convert it to the correct dtype and that is not happening correctly?
To see if this looks like the inflection point, I set align_zeros=false in my y_out line and ran the script. I did not get the error, so it has something to do with the zeros variable being set to int32.
Of course, the remix function works a lot better with the zero crossing parameter set to True, so I am hoping there is a way to keep the align_zeros=True (or default) and not get the error.
(Note my np and librosa libraries are up to date via pip install).
Thanks for any help you can provide!