Skip to main content

Crate vibelang_dsp

Crate vibelang_dsp 

Source
Expand description

VibeLang DSP - SynthDef generation and UGen DSL.

This crate provides the synthesis definition layer for VibeLang:

  • Graph - Graph IR for synth construction (nodes, inputs, parameters)
  • Encoder - Binary encoding to SuperCollider’s scsyndef format
  • NodeRef - Opaque node references with arithmetic operators
  • Helpers - High-level DSP functions (envelopes, mixing, etc.)
  • UGens - Auto-generated UGen function library
  • Builder - SynthDef builder for closure-based definition
  • API - Rhai API for define_synthdef and define_fx

§Architecture

SynthDefs are built using a thread-local graph builder pattern:

  1. Set the active builder with set_active_builder
  2. Add parameters, constants, and UGen nodes
  3. Finalize with clear_active_builder and get the GraphIR
  4. Encode to binary with encode_synthdef

Re-exports§

pub use api::clear_effect_registry;
pub use api::clear_modulator_registry;
pub use api::clear_synthdef_registry;
pub use api::effect_exists;
pub use api::get_all_effects_encoded;
pub use api::get_all_modulators_encoded;
pub use api::get_all_synthdefs_encoded;
pub use api::get_effect_param_defaults;
pub use api::get_modulator_param_defaults;
pub use api::get_synthdef_param_defaults;
pub use api::modulator_synthdef_exists;
pub use api::register_synthdef_api;
pub use api::register_synthdef_ir;
pub use api::set_deploy_callback;
pub use api::synthdef_exists;
pub use api::synthdef_or_effect_exists;
pub use api::FxBuilderHandle;
pub use api::ModulatorBuilderHandle;
pub use api::SynthDefBuilderHandle;
pub use builder::SynthDef;
pub use encoder::encode_synthdef;
pub use errors::Result;
pub use errors::SynthDefError;
pub use graph::clear_active_builder;
pub use graph::set_active_builder;
pub use graph::with_builder;
pub use graph::GraphBuilderInner;
pub use graph::GraphIR;
pub use graph::Input;
pub use graph::ParamSpec;
pub use graph::Rate;
pub use graph::UGenNode;
pub use helpers::amp_to_db;
pub use helpers::channel;
pub use helpers::channels;
pub use helpers::db_to_amp;
pub use helpers::detune_spread;
pub use helpers::dup;
pub use helpers::env_gen;
pub use helpers::env_gen_with_env;
pub use helpers::env_gen_with_env_n;
pub use helpers::in_ar;
pub use helpers::in_ar_n;
pub use helpers::mix;
pub use helpers::replace_out_ar;
pub use helpers::replace_out_ar_n;
pub use helpers::Env;
pub use helpers::EnvGenBuilder;
pub use rhainodes::register_node_ref;
pub use rhainodes::NodeRef;

Modules§

api
Rhai API for SynthDef definition.
builder
SynthDef builder API for Rhai.
encoder
SynthDef v2 binary encoder.
errors
Error types for the vibelang-dsp crate.
graph
Graph builder and IR for UGen graphs.
helpers
High-level DSP helper functions.
rhainodes
NodeRef type for Rhai - opaque handles to graph nodes that support arithmetic.
system_synthdefs
System SynthDefs for VibeLang.

Functions§

register_dsp_api
Register all DSP types and functions with a Rhai engine. This includes UGens, NodeRef, helpers, and SynthDef builder API.
register_generated_ugens
Re-export the generated UGen registration function. Register all generated UGens with the Rhai engine.