Skip to main content

Crate manguebyte

Crate manguebyte 

Source
Expand description

The Manguebyte Audio Framework: real-time-safe audio for Rust.

This crate gathers the whole framework under one name. Each area lives in its own crate, which you can also depend on directly:

ModuleCrateWhat it holds
(root)manguebyte-coreAudioBuffer, Sample, Smoothed, atomics, spsc queue, NoDenormals, source (pulled audio sources)
dspmanguebyte-dspprocessor chains, sample-accurate events, MIDI, MPE and MIDI 2.0 read into per-note events, audio sources built from sources, polyphonic synth, instruments, filters, effects, dynamics with sidechain keying, convolution, wavetables, FFT, response curves for drawing
paramsmanguebyte-paramsthread-safe parameters, ranges, smoothing, saved state
graphmanguebyte-grapha processing graph that can be rewired while it plays
pluginmanguebyte-pluginthe format-independent plugin API and a test harness
midimanguebyte-midiMIDI 1.0 and 2.0 messages, stream parsing, MIDI files, MPE, MIDI-CI, sample-accurate event buffers
formatsmanguebyte-formatsaudio file reading and writing, metadata, waveform thumbnails; AAC, ALAC and WMA through the system’s codecs (feature platform-codecs); streamed playback with a transport
clapmanguebyte-clapbuilds CLAP plugins (feature clap)
vst3manguebyte-vst3builds VST 3 plugins (feature vst3)
lv2manguebyte-lv2builds LV2 plugins and their Turtle files (feature lv2)
aumanguebyte-aubuilds Audio Units for macOS and their Info.plist (feature au)
guimanguebyte-guiopens a plugin’s editor in the host’s window (feature gui)
uimanguebyte-uithe widgets editors are made of (feature gui)
samplermanguebyte-sampleran SFZ sampler, from files or from memory (feature sampler)
hostmanguebyte-hostloads CLAP, VST 3, LV2 and Audio Unit plugins and runs them as processors, and scans for them out of process (feature host)
analysismanguebyte-analysisloudness, true peak, level meters, spectrum and pitch (feature analysis, on by default)
oscmanguebyte-oscOpen Sound Control, with time tags landing on their frame (feature osc, on by default)
standalonemanguebyte-standaloneruns a plugin on the sound card and MIDI ports (feature standalone)
devicesmanguebyte-devicesaudio hosts, device input, output and duplex streams, a device manager with saved setups and hot-plug, MIDI ports (feature devices, on by default)

§Example

Render a filtered sawtooth and save it as a WAV file:

use manguebyte::prelude::*;

let spec = ProcessSpec { sample_rate: 48_000.0, max_block_size: 480, num_channels: 2 };
let mut voice = (
    Oscillator::new(Waveform::Saw, note_to_hz(45.0)),
    Filter::new(FilterShape::Lowpass, 1_200.0, 1.5),
    Gain::from_db(-12.0),
);
voice.prepare(&spec);

let mut block = AudioBuffer::<f32>::new(2, 480);
voice.process(&mut block);

let mut file = Vec::new();
wav::write(&mut file, &block, 48_000, WavFormat::Int16)?;

Re-exports§

pub use manguebyte_analysis as analysis;
pub use manguebyte_au as au;
pub use manguebyte_clap as clap;
pub use manguebyte_devices as devices;
pub use manguebyte_dsp as dsp;
pub use manguebyte_formats as formats;
pub use manguebyte_graph as graph;
pub use manguebyte_gui as gui;
pub use manguebyte_host as host;
pub use manguebyte_lv2 as lv2;
pub use manguebyte_midi as midi;
pub use manguebyte_osc as osc;
pub use manguebyte_params as params;
pub use manguebyte_plugin as plugin;
pub use manguebyte_sampler as sampler;
pub use manguebyte_standalone as standalone;
pub use manguebyte_ui as ui;
pub use manguebyte_vst3 as vst3;

Modules§

decibels
Conversions between decibels and linear gain.
prelude
The names most programs need, in one import.
source
Sources of audio that are pulled, a block at a time.
spsc
A wait-free single-producer single-consumer queue.

Structs§

AtomicF32
An f32 that can be read and written from several threads without locks.
AtomicF64
An f64 that can be read and written from several threads without locks.
AudioBuffer
A planar, multi-channel block of audio samples.
DrainedLog
What one drain found.
LogQueue
Messages from any thread, the audio thread included, to a thread that may block. See the module documentation.
LogRecord
One message taken from a LogQueue.
NoDenormals
While one of these is alive, the processor treats subnormal numbers as zero on the current thread.
ParamId
A compact, stable number standing for a parameter.
Smoothed
A value that glides linearly towards its target, avoiding clicks when a parameter changes.

Enums§

LogLevel
How much a message matters, from most to least.

Traits§

Sample
A floating-point audio sample.