MCPcopy Index your code
hub / github.com/christian-grothe/grainiac

github.com/christian-grothe/grainiac @v0.1.12

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.1.12 ↗ · + Follow
230 symbols 387 edges 38 files 0 documented · 0% updated 2mo ago★ 58
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Grainiac

Grainiac is a granular sampler. It currently runs as a vst3 plugin, standlone with a tui and a vst3 plugin with a tui style interface which is currently experimental and under development.

Demo#1 Demo#2

Project Structure

Crate Description
grainiac_core Core audio DSP engine (no UI dependencies)
grainiac_tui Standalone JACK client with Ratatui TUI
grainiac_plugin_tui VST3/CLAP plugin with Ratatui TUI editor (experimental)
grainiac_plugin_gui Vizia-based GUI plugin
midi_ctrl PlatformIO firmware for Teensy 4.0 MIDI controller

Config

You need a config.json file under ~/.config/grainiac/ with the following schema:

{
  "presets": [
    {
      "gain": [0.5, 0.5, 0.5, 0.5],
      "loop_start": [0.25, 0.25, 0.25, 0.25],
      "loop_length": [0.5, 0.5, 0.5, 0.5],
      "density": [0.5, 0.5, 0.5, 0.5],
      "grain_length": [0.5, 0.5, 0.5, 0.5],
      "play_speed": [1.0, 1.0, 1.0, 1.0],
      "spray": [0.1, 0.1, 0.1, 0.1],
      "pan": [0.0, 0.0, 0.0, 0.0],
      "spread": [1.0, 1.0, 1.0, 1.0],
      "attack": [0.25, 0.25, 0.25, 0.25],
      "release": [0.25, 0.25, 0.25, 0.25],
      "pitch": [1, 1, 1, 1],
      "play_dir": [0, 0, 0, 0],
      "grain_dir": [0, 0, 0, 0],
      "mode": [0, 0, 0, 0],
      "name": "preset_1",
      "char": "1"
    }
  ],
  "mapping": {
    "loop_start": 40,
    "loop_length": 41,
    "density": 42,
    "grain_length": 43,
    "play_speed": 44,
    "spray": 45,
    "pan": 46,
    "spread": 47,
    "attack": 48,
    "release": 49,
    "pitch": 50,
    "gain": 51,
    "record": 52,
    "hold": 53,
    "play_dir": 54,
    "grain_dir": 55,
    "mode": 56
  }
}

The arrays under presets represent tracks A to D. The char field is the key to press to load the preset. The name field is currently unused.

The mapping section maps MIDI CC numbers to parameters. Each track corresponds to a MIDI channel (channel 1 = track A, channel 2 = track B, etc.).

To save and load audio files, manually create the folder ~/.local/share/grainiac/.

Key Mappings

Key Function
m change mode
0..9 load / save
n switch view
esc close

Core symbols most depended-on inside this repo

map
called by 28
grainiac_plugin_tui/src/ratavstui.rs
next
called by 8
grainiac_tui/src/state.rs
set_loop_length
called by 5
grainiac_core/src/lib.rs
resize
called by 4
grainiac_core/src/voice.rs
update
called by 4
grainiac_core/src/voice.rs
set_state
called by 4
grainiac_core/src/voice.rs
note_on
called by 4
grainiac_core/src/lib.rs
set_loop_start
called by 4
grainiac_core/src/lib.rs

Shape

Method 154
Class 44
Function 20
Enum 12

Languages

Rust96%
C++4%

Modules by API surface

grainiac_core/src/lib.rs35 symbols
grainiac_core/src/voice.rs34 symbols
grainiac_core/src/instance.rs20 symbols
grainiac_plugin_tui/src/ratavstui.rs17 symbols
grainiac_plugin_tui/src/lib.rs17 symbols
grainiac_plugin_gui/src/lib.rs17 symbols
grainiac_tui/src/state.rs10 symbols
grainiac_tui/src/main.rs9 symbols
grainiac_plugin_gui/src/editor.rs9 symbols
grainiac_core/src/grain.rs8 symbols
midi_ctrl/lib/components/components.h7 symbols
grainiac_plugin_gui/src/editor/widgets/dial_base.rs5 symbols

For agents

$ claude mcp add grainiac \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page