Crate knyst

source ·
Expand description

Knyst - audio graph and synthesis library

Knyst is a real time audio synthesis framework focusing on flexibility and performance. It’s main target use case is desktop multi-threaded real time environments, but it can also do single threaded and/or non real time synthesis. Embedded platforms are currently not supported, but on the roadmap.

The main selling point of Knyst is that the graph can be modified while it’s running: nodes and connections between nodes can be added/removed. It also supports shared resources such as wavetables and buffers.

Status

Knyst is in its early stages. Expect large breaking API changes between versions.

The name

“Knyst” is a Swedish word meaning very faint sound.

Architecture

The core of Knyst is the Graph struct and the Gen trait. Graphs can have nodes containing anything that implements Gen. Graphs can also themselves be added as a node.

Nodes in a running Graph can be freed or signal to the Graph that they or the entire Graph should be freed. Connections between Nodes and the inputs and outputs of a Graph can also be changed while the Graph is running. This way, Knyst acheives a similar flexibility to SuperCollider.

It is easy to get things wrong when using a Graph as a Gen directly so that functionality is encapsulated. For the highest level Graph of your program you may want to use RunGraph to get a node which you can run in a real time thread or non real time to generate samples. Using the audio_backends this process is automated for you.

Modules

  • Audio backends for getting up and running quickly. To use the backends in this module you need to enable either the jack or the cpal feature.
  • Loading sound files and other data and reading from them. Module containing buffer functionality:
  • API for interacting with a running top level Graph from any number of threads without having to manually keep track of running Graph::update regularly.
  • A pretty barebones Envelope Gen
  • Graph is the audio graph, the core of Knyst. Implement Gen and you can be a Node.
  • Exports the most often used parts of Knyst
  • This module contains things related to scheduling that are more generic than graph internals.
  • Structs for dealing with time with determinism and high accuracy in seconds and beats.
  • Triggers
  • Wavetable synthesis
  • Simple pseudorandom number generator

Macros

Structs

Enums

  • Used for holding either an Id (user facing identifier) or Key (internal identifier) for certain APIs.
  • Combined error type for Knyst, containing any other error in the library.
  • Command to modify the Resources instance while it is being used on the audio thread. Prefer the methods on [KnystCommands] to making these directly.
  • Error from changing a Resources
  • Response to a ResourcesCommand. Usually used to send anything that deallocates away from the audio thread, but also reports any errors.
  • Specify what happens when a Gen is done with its processing. This translates to a GenState being returned from the Gen, but without additional parameters.

Traits

Functions

Type Definitions

  • The current sample type used throughout Knyst