Synthesis ToolKit (STK)

repository·master·Indexed 22 days ago

https://github.com/thestk/stk

An open-source C++ library of classes for audio signal processing and algorithmic synthesis. STK supports realtime audio and MIDI across Linux, macOS, and Windows, and can generate .snd, .wav, .aif, and .mat soundfiles. It features the StkFrames class for multichannel vectorized audio data and supports control via raw MIDI and SKINI (Synthesis ToolKit Instrument Network Interface). The library is designed for rapid development, cross-platform portability, and educational use in music technology.

Tokens
5.5K
Snippets
11
Records
48
Agent score
78%

What's inside STK

  1. Overview of the Synthesis ToolKit (STK)

    master

    The Synthesis ToolKit in C++ (STK) is an open-source set of C++ classes designed for audio signal processing and algorithmic synthesis. It is intended for rapid development of music synthesis and audio processing software.

    Key Characteristics:

    • Portability: Most classes are platform-independent C++ code. It supports realtime audio and MIDI on Linux, macOS, and Windows.
    • Extensibility: All source code is included, allowing users to modify or extend classes easily.
    • Output Formats: STK can generate simultaneous .snd (AU), .wav, .aif, and .mat (Matlab) soundfiles, as well as realtime audio output.
    • Control Interfaces: Supports raw MIDI and SKINI (Synthesis ToolKit Instrument Network Interface), a MIDI-like text message format. The Messager class allows for simultaneous piped, socketed, and/or MIDI input control messages.
  2. Overview of the Effects Project

    master

    The Effects Project is a demonstration program within the Synthesis ToolKit (STK) that showcases:

    • Realtime duplex mode: Simultaneous audio input and output operation.
    • Delay-line based effects: Implementation of several simple audio effects algorithms.

    Hardware Requirements & Troubleshooting:

    • Audio Input: An audio input device (microphone or line-in) must be available and connected to the audio input port when the program starts.
    • Soundcard Compatibility: Ensure your soundcard supports the required sample rate and 16-bit sample size. If the application fails, verify these hardware specifications.
    • Platform Support: This project is not compatible with WindowsNT or NeXTStep due to lack of realtime audio input support. It is intended to run on other flavors of Windows and compatible platforms.
  3. Get started with the Synthesis ToolKit (STK)

    master
    The Synthesis ToolKit in C++ (STK) is a toolkit for sound synthesis. For general information regarding installation, usage, and core concepts, refer to the README and INSTALL files in the repository root. This specific document (README-SGI.txt) contains specialized information for SGI (Silicon Graphics) hardware users.
  4. Generate and control STK audio samples in iOS

    master

    The iOS demo project demonstrates how to:

    1. Generate audio samples using STK classes.
    2. Control STK objects via UI controls.

    Important: The demo project does not output sound directly. The generated audio samples must be fed into an audio engine (such as an iOS audio unit or similar) to be audible.

  5. Controlling Latency in the Effects Project

    master

    Latency in the Effects Project is controlled via the nBufferFrames argument passed to the RtAudio::openStream() function.

    Note on Stability: The default settings in effects.cpp use relatively high buffer frame counts. This is a precaution because certain Windows soundcard drivers may crash if the latency settings are set too low.

  6. Voice management and MIDI mapping in eguitar

    master

    The eguitar program implements voice management based on MIDI channel values:

    • Channel 0: If all noteOn and noteOff events are on channel 0, the program performs simple voice management.
    • Channels > 0: MIDI channel values greater than 0 are mapped to specific string numbers.

    By default, the model simulates a 6-string guitar. Additionally, if the normalized noteOn() velocity is less than 0.2, the string is undamped but not plucked (utilizing the stk::Guitar class behavior), allowing for experimentation with string coupling by lightly depressing keys.

  7. How multichannel audio is handled with StkFrames

    master
    STK uses the StkFrames class to facilitate the handling and passing of multichannel, vectorized audio data. To support this, all STK classes have been updated to include tick() functions that accept StkFrames arguments, allowing for more efficient processing of audio buffers.
  8. Configure raw wave file paths for STK

    master

    Classes that utilize raw wave files (such as Mandolin, Wurley, or Rhodey) require you to explicitly set the path to the raw wave files using stk::Stk::setRawwavePath before use.

    If using CocoaPods

    Use this snippet to set the path using the main bundle:

    stk::Stk::setRawwavePath([[[NSBundle mainBundle] pathForResource:@"rawwaves" ofType:@"bundle"] UTF8String]);

    If installing manually

    1. In your project settings, go to the Build Phases tab.
    2. Under Copy Bundle Resources, drag and drop rawwaves.bundle (found in the STK.xcodeproj's Helpers folder).
    3. Use this snippet to set the path:
    NSBundle *rawwaveBundle = [NSBundle bundleWithURL:[[NSBundle mainBundle] URLForResource:@"rawwaves" withExtension:@"bundle"]];
    stk::Stk::setRawwavePath([[rawwaveBundle resourcePath] UTF8String]);
  9. How to add a new instrument model to RagaMatic

    master

    To extend RagaMatic with a new instrument (e.g., a flute model), you must perform the following steps:

    1. Update the Makefile to include the new source files.
    2. Modify ragamat.cpp to implement the instrument's logic and playing behavior.
    3. Add a new slider to the TCL script to provide user control over the instrument's contributions.