# GlitchSprinkler

GlitchSprinkler is a synthesizer specialized to play fast arpeggios. It is using a cheap anti-aliasing trick that is to restrict the oscillator period only to integer sample counts. This anti-aliasing has a side effect to make the pitches out of tune, especially at higher notes, which makes a unique texture.

- Download GlitchSprinkler 0.1.3 `full` - VST 3 (github.com)
- Download GlitchSprinkler 0.1.3 `macOS` - VST 3 (github.com)

Note: Presets produce the expected sound only if the sampling rate is 48000 Hz.

`full` package contains following builds.

- Windows (x86_64)
- Linux (x86_64)
- macOS (Universal 2)

Linux build is built on Ubuntu 24.04. If you are using distribution other than Ubuntu 24.04, plugin will not likely to run. In this case, please take a look at build instruction.

`macOS` package is recommended for macOS user. I can’t purchase Apple Developer Program, therefore installation requires a workaround to bypass Gatekeeper. Details of workaround are written in Installation -> macOS Specific section.

## Contact

Feel free to contact me on GitHub repository or `ryukau@gmail.com.`

You can fund the development through paypal.me/ryukau.

## Installation

### Plugin

Move `*.vst3` directory to:

- `/Program Files/Common Files/VST3/` for Windows.
- `$HOME/.vst3/` for Linux.
- `/Users/$USERNAME/Library/Audio/Plug-ins/VST3/` for macOS.

DAW may provides additional VST3 directory. For more information, please refer to the manual of the DAW.

### Presets

Notice: Some plugins don’t have presets provided by Uhhyou Plugins.

Presets are included in the plugin package linked at the top of this page. To install presets, follow the steps below.

1. Download plugin from a link at the top of this page.
2. Extract downloaded zip file.
3. Open `presets` directory placed in extracted package.
4. Move `Uhhyou` directory into an OS specific preset directory (see below).

Below is a list of preset directories for each OS.

- Windows : `/Users/$USERNAME/Documents/VST3 Presets`
- Linux : `$HOME/.vst3/presets`
- macOS : `/Users/$USERNAME/Library/Audio/Presets`

Preset directory name must be the same as the plugin. If preset directory does not exist, create it.

- Preset Locations - VST 3 Developer Portal

### Windows Specific

If DAW doesn’t recognize the plugin, try installing C++ redistributable (`vc_redist.x64.exe`). Installer can be found in the link below.

- Latest supported Visual C++ Redistributable downloads | Microsoft Learn

### Linux Specific

On Ubuntu 24.04, those packages are required.

    sudo apt install libxcb-cursor0  libxkbcommon-x11-0

If DAW doesn’t recognize the plugin, take a look at `Package Requirements` section of the link below and make sure all the VST3 related package is installed.

- VSTGUI: Setup

REAPER on Linux may not recognize the plugin. A workaround is to delete a file `~/.config/REAPER/reaper-vstplugins64.ini` and restart REAPER.

### macOS Specific

Important: `full` package is not confirmed working. When using `full`, try removing following files.

- `Contents/Resources/Documentation`
- `Contents/x86_64-linux`
- `Contents/x86_64-win`

`macOS` package doesn’t contain above files. Also, all packages are in “ad-hoc signing” state set by `codesign` command.

#### Remove Quarantine

When trying to run plugin first time, following message may appear on macOS.

    <PluginName>.vst3 is damaged and can't be opened. You should move it to the Trash.

In this case, open terminal and try running one or both of following command to unzipped `.vst3` directory. Replace `/path/to/PluginName.vst3` according to your install location.

    xattr -rd com.apple.quarantine /path/to/PluginName.vst3
    xattr -rc /path/to/PluginName.vst3

#### Bypass Gatekeeper

Plugin may be considered as unsigned/un-notarized application. In this case, open System Preferences, go to Security & Privacy → General, then click the Open Anyway button. The offcial Apple help page linked below has screenshots for the procedure. See “If you want to open an app that hasn’t been notarized or is from an unidentified developer” section.

- Safely open apps on your Mac - Apple Support

If the plugin is still not working, try changing install location to `/Library/Audio/Plug-ins/VST3/` or `/Users/$USERNAME/Library/Audio/Plug-ins/VST3/` whichever still haven’t tried.

If all the above methods do not work, try following the steps below.

1. Open terminal and run `sudo spctl --master-disable`.
2. Go to System Preferences → Security and Privacy → General → Allow apps downloaded from, then select “Anywhere”.

Beware that steps above degrades security of your system. To revert the settings, follow the steps below.

1. Go to System Preferences → Security and Privacy → General → Allow apps downloaded from, then select option to “App Store and identified developers”.
2. Open terminal and run `sudo spctl --master-enable`.

#### Applying `codesign`

Note This section may not relevant to `macOS` packages. However it’s not verified. (GitHub issue)

To use `full` package, following command might be used.

    sudo codesign --force --deep -s - /path/to/PluginName.vst3

`codesign` might not be available without installing Xcode.

#### Reference

- Safely open apps on your Mac - Apple Support
- java - “libprism_sw.dylib” cannot be opened because the developer cannot be verified. on mac JAVAFX - Stack Overflow
- How to Fix App “is damaged and can’t be opened. You should move it to the Trash” Error on Mac
- Allowing unsigned/un-notarized applications/plugins in Mac OS | Venn Audio

## GUI Style Configuration

At first time, create color config file to:

- `/Users/USERNAME/AppData/Roaming/UhhyouPlugins/style/style.json` on Windows.
- `$XDG_CONFIG_HOME/UhhyouPlugins/style/style.json` on Linux.
  - If `$XDG_CONFIG_HOME` is empty, make `$HOME/.config/UhhyouPlugins/style/style.json`.
- `/Users/$USERNAME/Library/Preferences/UhhyouPlugins/style/style.json` on macOS.

`style.json` will be loaded for each time a plugin window opens.

Several color themes are available on the link below. To use, copy the text to `style.json`.

- VSTPlugins/package/style/themes at master · ryukau/VSTPlugins

Below is an example of `style.json`.

    {
      "guiScale"          : 1          ,
      "fontFamily"        : "Tinos"    ,
      "fontBold"          : true       ,
      "fontItalic"        : true       ,
      "foreground"        : "#000000"  ,
      "foregroundButtonOn": "#000000"  ,
      "foregroundInactive": "#8a8a8a"  ,
      "background"        : "#ffffff"  ,
      "boxBackground"     : "#ffffff"  ,
      "border"            : "#000000"  ,
      "borderCheckbox"    : "#000000"  ,
      "borderLabel"       : "#000000"  ,
      "unfocused"         : "#dddddd"  ,
      "highlightMain"     : "#0ba4f1"  ,
      "highlightAccent"   : "#13c136"  ,
      "highlightButton"   : "#fcc04f"  ,
      "highlightWarning"  : "#fc8080"  ,
      "overlay"           : "#00000088",
      "overlayHighlight"  : "#00ff0033"
    }

### GUI Scale

- `guiScale`: GUI scaling. For example, `0.75` is 75%, and `2.0` is 200%.

The minimum of `guiScale` is `0.01`. The maximum is practically non-existent (the max value of 64-bit float).

Notice: If `guiScale` is too large, DAW may place the “close” button on the plugin window out of screen, making it unclickable.

### Font Options

Following is a list of font options.

- `fontFamily`: Font family name.
- `fontBold`: Enable bold style when `true`, disable when `false`.
- `fontItalic`: Enable italic style when `true`, disable when `false`.

System font can be used as `fontFamily`. To use different fonts for different plugins, place `*.ttf` file into custom font path: `*.vst3/Contents/Resources/Fonts`.

Notice: If the combination of `fontFamily`, `fontBold`, `fontItalic` does not exist in custom font path, default font of VSTGUI is used.

If `fontFamily` is set to empty string `""`, then `"Tinos"` is used as fallback. If the length is greater than 1 and the font family name doesn’t exist, default font of VSTGUI is used.

Styles other than bold, italic or bold-italic are not supported by VSTGUI. For example, “Thin”, “Light”, “Medium”, and “Black” weights cannot be used.

### Color Options

Hex color codes are used.

- 6 digit color is RGB.
- 8 digit color is RGBA.

First letter `#` is conventional. Plugins ignore the first letter of color code, thus `?102938`, `\n11335577` are valid.

Do not use characters outside of `0-9a-f` for color value.

Following is a list of color options. If an option is missing, default color will be used.

- `foreground`: Text color.
- `foregroundButtonOn`: Text color of active toggle button. Recommend to use the same value of `foreground` or `boxBackground`.
- `foregroundInactive`: Text color of inactive components. Currently, only used for TabView.
- `background`: Background color.
- `boxBackground`: Background color of inside of box shaped components (Barbox, Button, Checkbox, OptionMenu, TextKnob, VSlider).
- `border`: Border color of box shaped components.
- `borderCheckbox`: Border color of CheckBox.
- `borderLabel`: Line color of parameter section label.
- `unfocused`: Color to fill unfocused components. Currently, only used for knobs.
- `highlightMain`: Color to indicate focus is on a component. Highlight colors are also used for value of slider components (BarBox and VSlider).
- `highlightAccent`: Same as `highlightMain`. Used for cosmetics.
- `highlightButton`: Color to indicate focus is on a button.
- `highlightWarning`: Same as `highlightMain`, but only used for parameters which requires extra caution.
- `overlay`: Overlay color. Used to overlay texts and indicators.
- `overlayHighlight`: Overlay color to highlight current focus.

## Controls

`Right Click` on the controls pops up a context menu provided by DAW.

Knob and slider provides following controls:

- `Ctrl` + `Left Click`: Reset value.
- `Shift` + `Left Drag`: Fine adjustment.
- `Middle Click` : Rotate through minimum, default and maximum value.
- `Shift` + `Middle Click` : Take floor of current value.
  - Note: For decibel (`dB`) parameters, floor is applied after the value is converted to amplitude.

## Caution

The pitch becomes more out of tune for higher notes. This is a side effect of anti-aliasing used in GlitchSprinkler.

Direct current may appear. Setting `Safety Filter Mix` to 1 applies a high-pass filter with -6 dB/oct slope. If the spike on the transient is too large, it is recommended to use external high-pass filter with steeper slope.

## MIDI Channel 16

Note events come from MIDI channel 16 doesn’t make any sound. Instead, those ch.16 notes change the pitch of incoming notes. Note that the pitch of the notes can’t be changed when they are already being played.

The modification of a note pitch is shown below. It is a multiplication of the note number to a note frequency, which can be used to play integer harmonic series.

    noteFrequency = baseFrequency * lastNoteNumberOnChannel16;

## Block Diagram

If the image is small, use `Ctrl` + `Mouse Wheel` or “View Image” on right click menu to scale.

Diagram only shows overview. It’s not exact implementation.

## Parameters

Characters inside of square brackets [] represents unit. Following is a list of units used in GlitchSprinkler.

- [dB] : Decibel.
- [oct] : Octave.
- [st.] : Ssemitone. 1 semitone is `1 / 12` octave.
- [cent] : Cent. 1 cent is `1 / 100` semitone.

### Oscillator

Output [dB]

  Output gain.

Safety Filter Mix

  Ratio between the direct output and the high-pass filtered output. The value 1 means 100% high-pass filtered output.

  This -6 dB/oct high-pass filter is used to remove direct current (DC). When the DC is high, it may cause an amplitude spike at the beginning of the sound (transient). In this case, it may be better to switching to an external high-pass filter with steeper attenuation.

  Below is an overview of the signal flow:

      hp = highpass(input);
      output = input + (Safety Filter Mix) * (hp - input);

Decay to [dB]

  Target gain of the decay envelope after the minimum duration of a note in the arpeggio.

  The minimum duration of a note in the arpeggio depends on the tempo specified on DAW, and the value of `Note / Beat`. The formula is as follows:

      samplesPerBeat = 60 * sampleRate / tempo;
      noteDurationInSamples = samplesPerBeat / (`Note / Beat`);

Polyphonic

  Turn it on when playing chords. Turn it off when playing a monophonic melody.

  When turned on, up to 256 voices can be played simultaneously. When turned off, `nVoice` in the `Unison` section becomes the number of voices played simultaneously.

Release

  When turned on, the envelope continues to decay even after the note-off.

  When turned off, the sound stops after the waveform completes the current cycle after the note-off. If the pitch is low, the sound will persist for a while, even when `Release` is turned off.

  This is a switch similar to the sustain pedal on a piano.

Soft Envelope

  When turned on, reduces pop noise at the beginning and end of the sound.

  The pop noise is especially noticeable when `Filter` is on and at low pitches.

Octave

  Transpose in octave.

Semitone

  Transpose in semitone. `Tuning` changes the ratio of semitone.

Cent

  Transpose in cent. Unlike `Semitone`, `Cent` always uses the ratio of 12 equal temperament.

Tuning

  Musical tunings.

  - `ET N` : N equal temperament.
  - `Just N` : N-limit tuning.
    - `Just 5 Major` : So-called just intonation. Adjusted to reduce the beat of +4 semitones.
    - `Just 5 Minor` : So-called just intonation. Adjusted to reduce the beat of +3 semitones.
  - `MT Pythagorean` : Pythagorean tuning.
  - `MT 1/3 Comma` : 1 / 3 comma mean tone.
  - `MT 1/4 Comma` : 1 / 4 comma mean tone.
  - Discrete N`: 12-tone equal temperament with the sampling rate divided by`N` as the center frequency.

  The pitches of the `Discrete` scales change significantly depending on the sampling rate.

  `Discrete 2` has a similar pitch to `ET 12` when transposed +1 semitone when the sampling rate is 48000 Hz.

Tuning Root [st.]

  Root of non-equal temperament scales.

  For example, suppose we have the following three-tone scale:

      [1, 5/4, 4/3]

  When `Tuning Root` is 0, the above scale is used as is.

  When `Tuning Root` is 1, the above scale is shifted to the left by 1, then it is wrapped around to an octave.

         [           1,            5/4,         4/3]
      -> [         5/4,            4/3,           1] // Left shift.
      -> [(5/4) / (4/5), (4/3) / (4/5), (1) / (4/5)] // Divide all the values with the leftmost ratio.
      -> [            1,         16/15,         4/5]
      -> [            1,         16/15,         8/5] // Wrap around to an octave.

### Filter

The filter is a resonant low-pass with -6 dB/oct slope. Note that enabling the filter increases CPU load.

Due to the nature of the filter, the resonance will never be higher than around `fs / 6` where `fs` is the sampling rate. In other words, the texture of the resonance changes depending on the sampling rate.

Decay Time Ratio [dB]

  Decay time of the filter envelope, calculated as a ratio from `Decay to` in the `Oscillator` section.

Key Follow

  Ratio to match the cutoff frequency to the pitch of the note.

  When `Cutoff` is 0 and `Key Follow` is 1, the frequency of the note matches the cutoff frequency when the filter envelope is fully decayed.

  When `Cutoff` is 0 and `Key Follow` is 0, the cutoff frequency will be 20 Hz when the filter envelope is fully decayed.

  The following is the formula for calculating the cutoff frequency (`adjustedCutoffHz`) when the filter envelope is fully decayed.

      baseCutoffHz = 20 + (Key Follow) * (freqHz - 20);
      adjustedCutoffHz = baseCutoffHz * 2^(Cutoff);

Cutoff [oct.]

  Cutoff frequency of low-pass filter.

Resonance

  Resonance of low-pass filter.

Notch [oct.]

  This one changes some character of low-pass filter.

  Technically, this parameter changes the cutoff frequency of all-pass filter placed on the feedback path. On amplitude response, it makes some notch and changes the intensity of the resonance.

### Waveform

In GlitchSprinkler, all waveform parameters except `Pulse Width / Bit Mask` will be fixed at note-on. This is intentional tuning to suppress noise when playing fast arpeggios.

(Waveform Editor), Xn, Yn

  Control points of the polynomial oscillator.

  Due to the nature of polynomial approximation, the waveform will be wavy. Recommend to use randomization, and avoid manual adjustments as much as possible.

  Below is a list of shortcuts of Waveform Editor. Shortcuts are enabled after left clicking Waveform Editor and only enabled when mouse cursor is stayed on Waveform Editor.

  Shortcut | Action
  --- | ---
  `r` | Randomize
  `t` | Small randomize only for Y axis.
  `0` | Preset : Silence
  `1` | Preset : Sine
  `2` | Preset : FM A
  `3` | Preset : FM B
  `4` | Preset : Sawtooth
  `5` | Preset : Triangle
  `6` | Preset : Trapezoid
  `7` | Preset : Alternate
  `8` | Preset : Pulse
  `9` | Preset : Saturated sine

Osc. Sync.

  Ratio of hard sync.

FM Index

  Intensity of frequency modulation (FM).

  FM algorithm is 1 operator feedforward. It means that the waveform is computed once, then that computed value is temporary added to phase, then that phase is used to compute the FM waveform.

Saturation [dB]

  Gain before hard clipping.

  This can be used to make square waves.

Pulse Width / Bit Mask

  Duty ratio of pulse wave. The pulse wave is multiplied to the waveform.

  When `Bitwise And` is on, bitwise and operation is applied to the phase of the oscillator instead of the pulse wave multiplication.

  Caution : If `Pulse Width / Bit Mask` is 1, and `PWM` is off, the output becomes silent due to the duty ratio becomes 0.

Modulation Rate

  Rate of pulse width modulation (PWM).

  Higher the value, the modulation becomes slower. Negative numbers make the modulation faster.

  The modulation rate changes depending on the pitch of the note.

PWM

  When turned on, pulse width modulation (PWM) will be activated.

  PWM becomes deeper when `Pulse Width / Bit Mask` approaches to 1.

Bidirectional

  When turned on, triangular wave is used for PWM. When turned off, sawtooth wave is used.

  When `PWM` is off, `Bidirectional` does nothing.

Bitwise And

  When turned on, the value of `Pulse Width / Bit Mask` will be used to apply bitwise and operation to the phase of the oscillator.

  When `Modulation Rate` is fast, bitwise and operation adds noisy texture to the sound.

### Arpeggio

GlitchSprinkler is designed specifically for playing fast arpeggios, with `Polyphonic` and `Soft Envelope` in the `Oscillator` section turned off, and `nVoice` in the `Unison` section set to 2.

Seed

  Seed value of the random number. Different `Seed` makes different melody.

Note / Beat

  Minimum duration of a note in the arpeggio.

  The default setting of 4 will play 4 notes per beat, which means that the minimum duration becomes 16th note.

Loop Length [beat]

  Loop length of arpeggio.

  Setting `Loop Length` to 0 practically disables looping. The actual loop length becomes 2^32 beats in this case.

Duration Variation

  Range of randomization of the length of the notes in the arpeggio.

  For example, when `Note / Beat` is 4, and `Duration Variation` is 3, the note lengths will be randomly chosen from 1 / 16, 2 / 16, and 3 / 16.

Rest Chance

  Chance to put a rest in the arpeggio.

  It works well with higher `nVoice`.

  Caution: Setting `Rest Chance` to 1 stops the sound, because the note will rest 100% of times.

Scale

  Musical scale used for arpeggator.

Pitch Drift [cent]

  Amount of randomization of the pitch of a note.

Octave Range

  Octave range used by the arpeggio.。

  Some scales span more than an octave, so the octave range may be wider than the specified value.

Start From Root

  When turned on, the first note of the arpeggio will be set to the pitch specified by the note-on.

Reset Modulation

  When turned on, resets the PWM phase every time a new note is played.

Random FM Index

  Amount of randomization for `FM Index`. Randomization amount changes for each note.

### Unison

nVoice

  Number of voices that is played with a note-on.

  Higher values ​​can be more CPU intensive, especially when `Release` is on. To save some CPU load, it’s better to reduce `nVoice` when playing higher notes.

Detune [cent]

  Amount of detune for unison voices.

Pan Spread

  Amount of left/right spread of the unison voices.

Scatter Arpeggio

  Only effective when `Arpeggio` is on. When turned on, each voice plays a different melody. When turned off, all voices play the same melody.

Gain Sqrt.

  Changes how the gain is adjusted according to `nVoice`.

  When turned on, the gain for each voice is set to `sqrt(nVoice)`. When turned off, the gain for each voice is set to `1 / (nVoice)`.

  It sounds more natural when turned on, but the peak amplitude may become quite loud.

## Change Log

- 0.1.3
  - Fixed a bug that GlitchSprinkler output silence when `Bitwise And` parameter was enabled.
- 0.1.2
  - Added GUI scaling.
  - Updated the Linux patch for VSTGUI4.
- 0.1.1
  - Fixed a bug that first modifier note (MIDI ch. 16) didn’t have effect when played at the same time as a voiced note.
- 0.0.1
  - Initial release.

## Old Versions

- GlitchSprinkler 0.1.2 - VST 3 (github.com)
- GlitchSprinkler 0.1.1 - VST 3 (github.com)
- GlitchSprinkler 0.0.1 - VST 3 (github.com)

## License

GlitchSprinkler is licensed under GPLv3. Complete licenses are linked below.

- https://github.com/ryukau/VSTPlugins/tree/master/License

If the link above doesn’t work, please send email to `ryukau@gmail.com`.

### About VST

VST is a trademark of Steinberg Media Technologies GmbH, registered in Europe and other countries.