[][src]Crate rsynth

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.

Back-ends

rsynth currently supports the following back-ends:

  • combined combine different back-ends for audio input, audio output, midi input and midi output, mostly for offline rendering and testing (behind various features)
  • jack (behind the backend-jack feature)
  • vst (behind the backend-vst feature)

See the documentation of each back-end for more information.

Rendering audio

Audio can be rendered by using a number of traits:

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":

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:

Utilities

Utilities are are types that you can include to perform several common tasks for the plugin or application:

Modules

backend

Backends.

buffer

Audio buffers.

envelopeDeprecated

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.

utilitiesDeprecated

Macros

audio_chunk

Create an audio chunk.

vst_init

A wrapper around the plugin_main! macro from the vst crate. 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

AudioHandler

Define how sample-rate changes are handled.

AudioHandlerMeta

Define the maximum number of audio inputs and the maximum number of audio outputs.

AudioRenderer

Defines how audio is rendered.

CommonAudioPortMeta

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 Meta trait.

CommonMidiPortMeta

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 Meta trait.

CommonPluginMeta

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 Meta trait.

ContextualAudioRenderer

Defines how audio is rendered, similar to the AudioRenderer trait. The extra parameter context can be used by the backend to provide extra information.

MidiHandlerMeta

Define the maximum number of midi inputs and the maximum number of midi outputs. This trait can be more conveniently implemented by implementing the Meta trait.