For a while I have been a big fan of the CLI tools now and have used them fairly extensively across Lua, Python and some other environments. More than I’d like to count I’ve written the same functions, classes and code plumbing to wrap up the command line calls which is obviously sub-optimal. I had a look at writing my own Python to C++ bindings using pybind11 or something fairly automatic with manual TLC applied afterwards or through configs but even then I think there are significant issues to overcome, particularly because Eigen complicates this problem. As such I’ve written what I think is the last set of loose bindings to the command line I’ll have to write. Yay!
So, here is me sharing it:
The interface is very Pythonic and the underlying code is fairly repetitious at the gain of not using any strange inheritance or multiple inheritance as I have done in some other side-ideas (https://github.com/jamesb93/FluidChain). This makes the code very readable and easy to understand.
From the README:
A basic call looks like this:
from flucoma import fluid from flucoma.utils import get_slices from pathlib import Path source = Path("~/Desktop/ec1.wav").expanduser().resolve() ns = fluid.noveltyslice(source, threshold=0.1) idx = get_buffer(ns) print(idx)
And a more complex one looks like this.
from flucoma import fluid from flucoma.utils import get_slices source = Path("~/Desktop/ec1.wav").expanduser().resolve() mfcc = fluid.mfcc(source, fftsettings = [2048, -1, -1], startframe = start, numframes = length ) stats = get_buffer( fluid.stats(mfcc, numderivs = 1 ), "numpy" # get_buffer() can return numpy arrays too ) print(stats)
You can get it by
pip installing it too:
pip install git+https://github.com/jamesb93/python-flucoma
Not all of the objects are implemented, I’m just doing them as I need them but hopefully people will find this useful in the future