Crate oscen

Source
Expand description

§Oscen - a library to build modular software synthesizers.

§The Oscen architecture is designed with the following objcectives in mind:

  • Extensible — Users of Oscen should be able to create their own synth modules without having to modify any of the library code, e.g. add cases to an enum. This is accomplished by defining the Signal trait and using trait objects to represent synth modules which can be added to a Rack (graph). Signal objects can be downcast using the Any trait to access specific features of that particular SynthModule.

  • Dynamic - The Rack should be able to be “patched” while the synth is running, similar to a modular hardware synth. A Rack is basically a graph where nodes are synth modules, e.g. oscillators, envelope generators and filters. Each node can have many inputs and a single output. Edges connect the ouput of one node to one of the inputs of another. Since we cannot know the names of the fields of a node (because it’s a trait object) We use the Index and IndexMut traits to access the fields by a &str.

  • Strongly Typed - As much as possible have the rust catch errors in our synth at comple time. This is difficult to do in light of the previous objective and some compromises have to be made. E.g., it is not possible to know at compile time about a patch that will be added while the synth is running.

Modules§

Macros§

  • Since as_any_mut() usually has the same implementation for any Signal we provide this macro for coneniene.
  • If your module has on and off methods you can use this macro to generate the Gate trait.
  • For Signals that have a tag field implement as_any_mut() and tag().