Expand description
§Rsynth
A crate for developing audio plugins and applications in Rust, with a focus on software synthesis. Rsynth is well suited as a bootstrap for common audio plugin generators. It handles voices, voice-stealing, polyphony, etc. so the programmer’s main focus can be DSP.
§Deprecation notice
This crate has been deprecated. See its README.md for more details.
§Back-ends
rsynth currently supports the following back-ends:
combinedcombine different back-ends for audio input, audio output, midi input and midi output, mostly for offline rendering and testing (behind various features)jack(behind thebackend-jackfeature)vst(behind thebackend-vstfeature)
See the documentation of each back-end for more information.
§Rendering audio
Audio can be rendered by using a number of traits:
- the
AudioRenderertrait - the
ContextualAudioRenderertrait
The difference between these traits is that the ContextualAudioRenderer trait adds one extra
parameter that defines a “context” that can be passed to the implementor of the trait, so that
the implementor of the trait does not need to own all data that is needed for rendering the
audio; it can also borrow some data with additional the context parameter.
Both traits are generic over the data type that represents the sample. For which specific data-type an application or plugin needs to implement the trait, depends on the back-end. Because the trait is generic, the application or plugin can have a generic implementation as well that can be used by different back-ends.
§Meta-data
There are a number of traits that an application or plugin needs to implement in order to define meta-data.
Every plugin should implement these, but it can be tedious, so you can implement these
traits in a more straightforward way by implementing the Meta trait.
However, you can also implement these trait “by hand”:
CommonPluginMeta- Name of the plugin etc
AudioHandlerMeta- Number of audio ports
MidiHandlerMeta- Number of midi ports
CommonAudioPortMeta- Names of the audio in and out ports
CommonPluginMeta- Name of the plugin or application
Additionally, back-ends can require extra trait related to meta-data.
§Handling events
Plugins or application can handle events by implementing a number of traits:
Both traits are generic over the event type.
These traits are very similar, the ContextualEventHandler trait adds one extra parameter
that defines a “context” that can be passed to the implementor of the trait, so that the
implementor of the trait does not need to own all data that is needed for handling the event;
it can also borrow some data with additional the context parameter.
§Events
rsynth defines a number of event types:
RawMidiEvent: a raw MIDI eventSysExEvent: a system exclusive eventTimed<T>: a generic timed eventIndexed<T>: a generic event that associates a timestamp with the event
§Utilities
Utilities are are types that you can include to perform several common tasks for the plugin or application:
- polyphony: managing of different voices
Modules§
- backend
- Backends.
- buffer
- Audio buffers.
- envelope
Deprecated - This module has not been thoroughly tested, so expect some rough edges here and there.
- event
- Event handling
- meta
- Mechanisms for defining the meta-data of a plugin or application.
- test_
utilities - Utilities for testing.
- utilities
Deprecated
Macros§
- audio_
chunk - Create an audio chunk.
- vst_
init - A wrapper around the
plugin_main!macro from thevstcrate. You call this with one parameter, which is the function declaration of a function that creates your plugin. This function may also do some setup (e.g. initialize logging).
Traits§
- Audio
Handler - Define how sample-rate changes are handled.
- Audio
Handler Meta - Define the maximum number of audio inputs and the maximum number of audio outputs.
- Audio
Renderer - Defines how audio is rendered.
- Common
Audio Port Meta - Provides some meta-data of the audio-ports used by the plugin or application to the host.
This trait can be more conveniently implemented by implementing the
Metatrait. - Common
Midi Port Meta - Provides some meta-data of the midi-ports used by the plugin or application to the host.
This trait can be more conveniently implemented by implementing the
Metatrait. - Common
Plugin Meta - Provides common meta-data of the plugin or application to the host.
This trait is common for all backends that need this info.
This trait can be more conveniently implemented by implementing the
Metatrait. - Contextual
Audio Renderer - Defines how audio is rendered, similar to the
AudioRenderertrait. The extra parametercontextcan be used by the backend to provide extra information. - Midi
Handler Meta - Define the maximum number of midi inputs and the maximum number of midi outputs.
This trait can be more conveniently implemented by implementing the
Metatrait.