How bgribble/mfp works
Project Type and Purpose
• MFP (“music for programmers”) is an environment for visually composing computer programs, with a specific focus on music, audio synthesis, and real-time processing.
• Its design is inspired by systems like Pure Data, Max/MSP, LabView, and TouchOSC and supports both live coding (in Python and Faust) and dynamic patch creation.
• The project encompasses a core interpreter/patch engine, a DSP subsystem for audio signal processing, built-in objects for various sound and control operations, and multiple GUI frontends.
File Structure for Architectural Clues
• Top-level directories and files such as “mfp”, “mfpdsp”, and “pluginfo” indicate separation between the core application logic (patching/interpreter), DSP processing, and plugin interfaces (e.g., LV2 support).
• The “mfp/builtins” directory lists all the built-in processing objects – these are the fundamental DSP/patch elements that users employ to create modular patches.
• The “mfp/gui” directory, along with its “clutter” and “imgui” subdirectories, reveals that there are at least two separate UI backends. This handles the visual display of patches and interacts with user events.
• There are test directories and “lib” folders (e.g., lib/alsaseq) which integrate external libraries like ALSA MIDI support.
• Configuration files (e.g., .github/workflows, setup.py, waf, wscript) indicate an established build and continuous integration process.
Major Components
a. Core Application Layer:
• MFP Interpreter/Patch Engine (files like mfp/interpreter.py, mfp/mfp_app.py, mfp/patch.py)
• Built-in objects and processing modules (mfp/builtins/* modules), which perform audio DSP and control tasks.
• Delegation systems, logging, and command parsing (mfp/delegate.py, mfp/log.py, mfp/method.py).
b. DSP Engine:
• The mfpdsp directory shows numerous C files for DSP operations (e.g., mfp_dsp.c, various builtin_*.c files).
• This layer is responsible for real-time audio synthesis, interfacing with external audio systems (like ALSA/jack via mfp_jack.c).
• Communication between interpreted patch instructions and compiled DSP routines.
c. GUI Frontends:
• Two parallel GUI systems: the “Clutter” UI interface (mfp/gui/clutter/*) and the “ImGUI” UI interface (mfp/gui/imgui/*).
• These frontends render the patch editor, display elements, parameter panels, and capture user input (touch, keyboard and mouse events).
• Core UI interactions include creating, editing, moving, and connecting patch elements.
d. Live Coding and Custom Code Integration:
• Support for embedding custom Python (and Faust) code in processors (as highlighted in the README for live coding and the “Custom code” parameters).
• This subprocess should be represented as an extension branch interacting with both the interpreter layer and the DSP execution flow.
e. External Services and Tools:
• Integration with external libraries like ALSA (in lib/alsaseq) for MIDI, and plugins support (pluginfo) for LV2.
• The “testext” directory suggests that external modules/extensions can be added to expand system functionality.
Relationships and Interactions
• The main UI (Clutter/ImGUI) receives user input and sends commands to the core patch engine.
• The patch engine loads a patch and maps it to built-in processing objects, which then invoke underlying DSP routines in the mfpdsp layer.
• Live coding functionality provides a dynamic link – updates from custom code immediately affect the behavior of processors.
• Audio processing flows from the DSP layer to the output hardware (with interfacing modules like mfp_jack.c handling real-time constraints).
• Testing and external tools (such as LV2 plugin wrappers) indicate that patches can be deployed in external hosts.
Detailing Specific Technologies and Libraries
• That the ImGUI backend relies on Dear ImGUI and the imgui-bundle.
• That the Clutter backend is available but legacy.
• That external libraries include ALSA (and possibly JACK) for MIDI/audio sequencing and LV2 for plugin support.
• Make a reference that Python is used for live coding, and Faust integration is allowed for DSP programming.