Hi all,
I took to making a new major version, 2.0.0, of the Python/FluCOMa CLI Bindings. The major motivation was to learn how dataclasses can be leveraged to make very simple object representations of the returns from the algorithms. As a result, I’ve come up with something that feels far more native (to me at least).
For example:
from pathlib import Path
from flucoma import fluid
source = Path("stereo_test.wav")
mfcc = fluid.mfcc(source, numcoeffs=5, numbands=20)
stats = fluid.stats(mfcc, numderivs=0)
# Let's see the data
for i, band in enumerate(stats):
printout = f"Stats for MFCC band number {i}: {band}"
is perhaps the most basic example. All the outputs are iterable with patterns and idioms that feel pythonic and you get a lot of flexibility in how you treat the objects as a result. Here is a more complicated example:
from pathlib import Path
from flucoma import fluid
source = Path("Nicol-LoopE-M.wav")
# Run HPSS on the source and return a custom DataClass
hpss = fluid.hpss(source)
# Retrieve the outputs by name
harmonic = hpss.harmonic
percussive = hpss.percussive
residual = hpss.residual
# This allows you to work programatically on the outputs
for x in hpss:
# As it stands these bindings return a path for everything, even if it wasnt made
# HPSS can return either 2 or 3 things depending on the mode its in
# So its worth checking that in this case the residual was made
# If it wasn't it would be a blank string so we just don't process these
print(x)
if x != "":
sines = fluid.sines(
x
) # The path printed here can be passed to something else for processing
print(sines.sines)
print(sines.residual)
Anyway. I’m not sure anyone but me was using this, but its out there for anyone to play with freely.