released FICUS, linux audio sampler api for jack in C (video)

  • Live demonstration of 'ficus', my nonblocking audio sampler api implemented in C for linux.

    The monome application you see is actually a wrapper around ficus, named 'candor' which facilitates the led-interface and sequencing. All parts of this project are C and GNU (except for libmonome!!)

    Candor's not really going to be ready for a bit, a few too many things wrong with it. But for now this is the api it was developed with:

    It is under active development, but seems to be pretty stable. Please feel free to contribute I don't mind giving regular contributors repo access.
    The to-do list includes a big code refactor, a way to turn off popping/clicking for a given soundfile, and midi.

    Ficus is a really simple api for capturing or playing back MONO wav files to/from your hard drive on your linux machine and theoretically, supporting an infinite number of input/output channels and soundfile banks. Accomplished thru the following functions..

    int ficus_setup(char *client_name, char *path, char *prefix, int bit_depth);

    int ficus_loadfile(char *path, int bank_number);

    int ficus_loop(int bank_number, int state);

    int ficus_setmixout(int numsample, int channel, int state);
    int ficus_setmixin(int numsample, int channel, int state);

    int ficus_jackmonitor(int channel, int state);

    void ficus_playback(int bank_number);
    int ficus_capture(int bank_number, int seconds);

    int ficus_capturef(int bank_number, int num_frames);
    int ficus_durationf(int bank_number);

    int ficus_killplayback(int bank_number);
    int ficus_killcapture(int bank_number);

    int ficus_isplaying(int numsample);
    int ficus_iscapturing(int numsample);
    int ficus_islooping(int numsample);

    void ficus_clean();

    The only boiler plate is the ficus_setup() and ficus_clean() functions, the rest can be used in any order between those two function calls for each 'ficus'(jack client) instance. (Just remember to ficus_loadfile() before trying to use ficus_playback()!!!) Documentation will slowly find its way into the source repository.

    Thanks! Hope you like it!

  • Hi! This looks really cool!

    I am looking to build my own sample cutter application for my gs 128, so this library looks like it is just what I need. Would you say that it is in a suitable state to be used as such?

    Also I am interested in contributing, if development is still active. Overall, I'm wondering what is the current state of this project?


  • Ficus *should* be great for this.

    It is an active project, but I haven't had any adopters so not any feedback.
    This api should handle sample splicing just fine, except for now it only reads and writes WAV files.

    Just don't plan on relying upon the "effects" like sample tempo. The amplitude ramps work fine, but playback speeds need some effort (but feel free to play with them!).

    Just send me an email if you get stuck/frustrated (listed on the README).

    Thanks for the interest!

  • murray,

    I finally got around to giving this a shot. I've downloaded the library and compiled the tests in the example directory. When I run them they work, but my cpu use goes very very high. Any idea why this would happen or what I should do to fix it?

  • Harlequin,

    Sorry it took me so long to get around to this.
    Best way is to get at me thru the code repo, since that hits my email (mrafoster at gmail dawt com).

    I noticed this too.
    Short answer is Ficus is nonblocking code, no mutexes or locks, so it's expected to run at least one of your cores at 100%.

    At first this worried me and I performed lots of testing with scenarios like a complex configuration of Ficus (~20 samples retriggered at fast tempo) under 20+ instances of DVD playback with mplayer but haven't been able to get audio to drop.

    Long answer is,
    I can look into forcing context switching within the library or add extra polls or something to lower the cpu, but I'm not sure the benefit will be anything but cosmetic.

  • Actually, refreshing myself on the code, maybe I was just being dense and there's an obvious solution here with an epoll or something.
    You've got me ditching my job's workpile, but this is so much more fun!