ysfx

repository·master·Indexed 41 days ago

https://github.com/joepvanlier/ysfx

A hosting library and audio plugin that provides a JSFX compiler and runtime to run audio and MIDI effects written in the JSFX language natively within a DAW or as a standalone plugin. Supports VST3, AU, and CLAP formats.

Tokens
1.5K
Snippets
6
Records
7
Agent score
2%

What's inside ysfx

  1. Organize JSFX source and resource files

    master

    The audio plugin initially looks for JSFX effects in REAPER user folders. However, you can install JSFX anywhere.

    To ensure resources (like wav files) are correctly located, use a side-by-side folder hierarchy with Effects and Data directories.

    Recommended Structure:

    • [Root Folder]/Effects/[Effect Name]/[Effect Code]
    • [Root Folder]/Data/[Resource Name]

    Example:

    • My JSFX/Effects/guitar/amp-model (contains the .jsfx file)
    • My JSFX/Data/amp_models/Marshall JCM800 - Marshall Stock 70.wav (contains the resource)
    My JSFX/
    ├── Effects/
    │   └── guitar/
    │       └── amp-model
    └── Data/
        └── amp_models/
            └── Marshall JCM800 - Marshall Stock 70.wav
  2. Optimize image loading in JSFX for ysfx

    master

    In ysfx, loading images inside the @init block is inefficient because it reloads the images on every @init execution.

    To optimize performance, use one of these two patterns:

    1. Use the file syntax at the top of the script:

    filename:0,img/background.png
    filename:1,img/poti_low_gain.png

    2. Load images in @gfx on the first pass:

    @gfx
    (!imgs_loaded) ? (
        // load images here
        imgs_loaded = 1;
    );
  3. Build ysfx from source

    master

    To build the library and audio plugin, you need a C++ development environment with Git and CMake. Run the following commands:

    1. Clone the repository.
    2. Initialize submodules.
    3. Create a build directory.
    4. Run CMake and build.
    git clone https://github.com/JoepVanlier/ysfx.git
    cd ysfx
    git submodule update --init --recursive
    mkdir build
    cd build
    cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo ..
    cmake --build .
  4. Install ysfx audio plugin

    master

    To install the ysfx plugin, drop the binary into your VST3, AU, or CLAP plugin folder.

    Windows Requirements:

    • You must install the MSVC redistributable. If you use an outdated version, the plugin may crash.
    • Download the 64-bit version: https://aka.ms/vs/17/release/vc_redist.x64.exe
    • Download the 32-bit version: https://aka.ms/vs/17/release/vc_redist.x86.exe
    • Alternatively, use the portable version which has the redistributable baked in.

    macOS Requirements:

    • Binaries are not signed. You must manually allow the plugin to run by removing the quarantine attribute using xattr.
    xattr -dr com.apple.quarantine /Path/To/Plugin/VST3/ysfx-s FX.vst3
    xattr -dr com.apple.quarantine /Path/To/Plugin/VST3/ysfx-s instrument.vst3
  5. Updating the WDL (Waveform Description Language) in ysfx

    master

    When updating the WDL to access newer EEL or LICE features, follow these steps to ensure compatibility and preserve custom edits:

    1. Identify the target revision: Check the commit log of the thirdparty/WDL subdirectory to find the current reference commit number. You can find this by running git log thirdparty/WDL. The latest commit comment should indicate the version, e.g., Update to WDL 862717c from upstream.
    2. Review upstream changes: In a fresh working copy of WDL, compare the target revision against the current upstream HEAD using git log <revision>..HEAD and git diff <revision>..HEAD.
    3. Apply changes via patching: Use git apply (or similar patching tools) to apply the diff from WDL into thirdparty/WDL. Do not copy files directly, as this may overwrite ysfx's custom edits. Avoid adding new files unless they are required dependencies.
    4. Handle Assembly changes (EEL2): If WDL/eel2/asm-nseel-x64-sse.asm has changed, you must:
      • Translate the changed assembly to GNU-compatible assembly in sources/eel2-gas/sources/asm-nseel-x64-sse.S.
      • Update the hash in sources/eel2-gas/sources/ref-hash-sha512.txt with the hash of the new .asm file.
      • Recompile with both NASM and GAS and verify that the disassemblies match.
    5. Handle LICE changes: If thirdparty/WDL/source/WDL/eel2/eel_lice.h has changed, manually copy only the relevant portions of code to sources/ysfx_api_gfx_lice.hpp.
    6. Commit: When committing, use a headline format like Update to WDL XXXXXXX from upstream and mention the new reference commit.
    # Check the current WDL revision
    git log thirdparty/WDL
    
    # Review changes from a specific revision to HEAD
    git log 862717c..HEAD
    git diff 862717c..HEAD
  6. What is YSFX and how does it work?

    master

    YSFX is a plugin that allows you to run audio and MIDI effects written in the JSFX language. These effects are provided as source code, which is then compiled and executed natively by the hosting software.

    Important Note: Despite the name, JSFX is not JavaScript. They are unrelated technologies.

    When using the CLAP or VST3 versions, you will encounter two variants for each effect:

    1. instrument: An instrument variant.
    2. FX: An effect variant.

    For most standard audio processing use cases, you should select the variant marked FX.

  7. Fix file browser not opening on Linux

    master

    On some Linux distributions (e.g., Debian Trixie), the native file chooser may fail to open. You can switch to a built-in file browsing dialog by modifying the configuration file.

    1. Close the plugin.
    2. Locate your application config folder (usually ~/.config).
    3. Open the file ysfx_saike_mod.prefs.
    4. Find the field ysfx_use_native_file_picker and set its value to 0.
    5. Save the file.
    # In ~/.config/ysfx_saike_mod.prefs
    ysfx_use_native_file_picker = 0