# TrapezoidSynth

TrapezoidSynth is a monophonic synthesizer equipped with 2 trapezoid oscillator. Trapezoid oscillator is based on PTR (Polynomial Transition Regions) and it has a drawback that increasing noise at high frequency. Therefore 8 times oversampled. 2 pitch shifters are added to make some chord.

- Download TrapezoidSynth 0.1.27 `full` - VST 3 (github.com)
- Download TrapezoidSynth 0.1.27 `macOS` - VST 3 (github.com)
- Download Presets (github.com)

`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

It is recommended to insert high-pass when setting `SlideType` to `Reset to 0`.

## 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

### Oscillator Common

Semi

  Change oscillator pitch in semitone.

Cent

  Change oscillator pitch in cent. 100 cent = 1 semitone.

Slope

  Change left and right side of slope of trapezoid.

PW

  Pulse width. Change length of upper side of trapezoid.

### Oscillator 1

Drift

  Modulate pitch with white noise.

Feedback

  Modulate phase of Oscillator 1 with feedback signal.

      osc1Phase += Feedback * (osc1 + OscMix * (osc2 - osc1))

### Oscillator 2

Overtone

  Multiply the frequency of oscillator by number of `Overtone`.

PM

  Modulate Osillator 1 phase with Oscillator 2 output.

### Envelope Common

Retrigger

  When checked, reset envelope for each note on. When not checked, reset envelope only if the number of pressed key is changed from 0 to 1 or more.

A

  Attack time in seconds.

D

  Decay time in seconds.

S

  Sustain level.

R

  Release time in seconds.

Curve

  Change envelope curve.

### Gain Envelope

Gain

  Master output gain.

### Filter

Order

  TrapezoidSynth is using 8 of serially connected first order filter. `Order` changes where to get the signal from the filter.

Cut

  Cutoff frequency in Hz.

Res

  Resonance.

Sat

  Filter saturation.

      filterInput = tanh(Sat * (input + Res * filterOutput))

Env>Cut

  Modulation amount from Filter Envelope to `Cut`.

Key>Cut

  Modulation amount from note pitch to `Cut`.

+OscMix

  Modulation amount from mixed signal of Oscillator 1 and Oscillator 2 to `Cut`.

### Filter Envelope

>Octave

  Modulation amount from Filter Envelope to pitch in octave.

### Misc

OscMix

  Ratio of Oscillator 1 and Oscillator 2. When turned to left-most, output becomes only the signal from Oscillator 1.

Octave

  Change pitch in octave.

Smooth

  Interpolation time in seconds from previous value to current value. Following parameters are affected by `Smooth`.

  - `Drift`
  - `Slope`
  - `PW` (for all parameter with identical name)
  - `Feedback` (for all parameter with identical name)
  - `PM`
  - `Gain` (for all parameter with identical name)
  - `Cut`
  - `Res`
  - `Sat`
  - `Env>Cut`
  - `Key>Cut`
  - `+OscMix`
  - `OscMix`
  - `>PM`
  - `>Feedback`
  - `>LFO`
  - `>Slope2`
  - `>Shifter1`
  - `Shifter1.Semi`
  - `Shifter1.Cent`
  - `Shifter2.Semi`
  - `Shifter2.Cent`
  - `Freq`
  - `Shape`
  - `>Pitch1`
  - `>Slope1`
  - `>PW1`
  - `>Cut`

### Mod Common

Retrigger

  When checked, reset envelope for each note on. When not checked, reset envelope only if the number of pressed key is changed from 0 to 1 or more.

Attack

  Modulation envelope attack time in seconds.

Curve

  Modulation envelope curve.

### Mod 1

>PM

  Modulation amount from modulation envelope 1 to `Oscillator2.PM`.

### Mod 2

>Feedback

  Modulation amount from modulation envelope 2 to `Oscillator1.Feedback`.

>LFO

  Modulation amount from modulation envelope 2 to `LFO.Freq`.

>Slope2

  Modulation amount from modulation envelope 2 to `Oscillator2.Slope`.

>Shifter1

  Modulation amount from modulation envelope 2 to Shifter 1 pitch.

### Shifter Common

Semi

  Change amount of pitch shift in semitone.

Cent

  Change amount of pitch shift pitch in cent. 100 cent = 1 semitone.

Gain

  Output gain of pitch shifter.

### LFO

LFOType

  4 waveforms are available for LFO.

  - `Sin` : Sine wave. Output will be power of the value of `Shape`.
  - `Saw` : Sawtooth wave. Can be turned into triangle with `Shape`.
  - `Pulse` : Pulse wave. Duty ratio can be controlled by `Shape`.
  - `Noise` : Brown noise. Wandering of noise can be changed by `Shape`.
Tempo

  Synchronize LFO frequency to tempo.

Freq

  LFO frequency.

Shape

  Change LFO wave shape.

>Pitch

  Modulation amount from LFO to Oscillator 1 pitch.

>Slope1

  Modulation amount from LFO to `Oscillator1.Slope`.

>PW1

  Modulation amount from LFO to `Oscillator1.PW`.

>PW1

  Modulation amount from LFO to `Filter.Cut`.

### Slide

SlideType

  3 type of pitch slide is available.

  - `Always` : Always slide from the pitch of last note.
  - `Sustain` : Only slide when 2 or more keys are pressed.
  - `Reset to 0` : When number of pressed key is changed from 0 to 1, or 1 to 0, pitch will be slide to 0 Hz. Otherwise, slide behaves same as other 2 options.
Time

  Time of pitch sliding.

Offset

  Oscillator 2 slide time with respect to Oscillator 1 slide time.

## Change Log

- 0.1.27
  - Added GUI scaling.
  - Updated the Linux patch for VSTGUI4.
- 0.1.26
  - Fixed GUI on Linux.
- 0.1.25
  - Changed to include presets in plugin zip package.
  - Fixed a bug that invalid `style.json` crashes plugin.
- 0.1.24
  - Changed default style color of `foregroundInactive`.
  - Fixed performance drop caused by subnormal floating point numbers.
- 0.1.23
  - Fixed crash on Renoise. Previous code was trying to access freed memory of GUI widgets, and it was causing the crash.
- 0.1.22
  - Fixed stuttering on Audacity where `processContext` is `nullptr`.
- 0.1.21
  - Added to `virtual` to destructor of common components. This may prevent some cause of crash or memory leak.
- 0.1.20
  - Updated VST 3 SDK to version 3.7.6. This also fixes the crash when opening multiple GUI of same plugin on Linux.
- 0.1.19
  - Resume macOS build.
- 0.1.18
  - Fixed crash on Linux.
- 0.1.17
  - Fixed the condition of acceptable channel count. This is a fix for unintentional muting on sidechain in REAPER.
- 0.1.16
  - Added custom font options for `style.json`.
- 0.1.15
  - Updated VSTGUI from 4.10 to 4.11.
- 0.1.14
  - Changed font to Tinos.
- 0.1.13
  - Fixed to reset properly.
  - Fixed `bypass` parameter behavior. This fixes playing all the notes at the moment of unmute, even if host sends note to plugin while muting. This bug was only happening on the hosts which respect VST 3 `bypass` parameter.
- 0.1.12
  - Implemented process context requirements.
- 0.1.11
  - Fixed `Slide->Time` is ignored and set as same as `Smooth`. Fix in 1.10 was incorrect.
- 0.1.10
  - Added check that DSP is initialized or not.
  - Fixed `Slide->Time` is ignored and set as same as `Smooth`.
- 0.1.9
  - Added color configuration.
- 0.1.8
  - Reverted parameter smoother to the old one which works with variable size audio buffer.
- 0.1.7
  - Fixed a bug that cause crash when drawing string.
- 0.1.6
  - Changed display method for pop-up which shows up by clicking plugin title.
- 0.1.5
  - Fixed a bug that was causing noise on PreSonus Studio One 4.6.1.
- 0.1.4
  - Enabled GUI for Linux build.
  - Fixed plugin type from `kFxInstrument` to `kInstrumentSynth`.
- 0.1.3
  - Fixed wobbling knob bug.
- 0.1.2
  - Added support for synchronization between multiple GUI instances.
  - Fixed a bug that opening splash screen causes crash.
  - Fixed GUI to follow host automation.
- 0.1.1
  - Fixed mistake in oscillator implementation.
- 0.1.0
  - Initial release.

## Old Versions

- TrapezoidSynth 0.1.26 - VST 3 (github.com)
- TrapezoidSynth 0.1.25 - VST 3 (github.com)
- TrapezoidSynth 0.1.24 - VST 3 (github.com)
- TrapezoidSynth 0.1.23 - VST 3 (github.com)
- TrapezoidSynth 0.1.22 - VST 3 (github.com)
- TrapezoidSynth 0.1.21 - VST 3 (github.com)
- TrapezoidSynth 0.1.20 - VST 3 (github.com)
- TrapezoidSynth 0.1.19 - VST 3 (github.com)
- TrapezoidSynth 0.1.18 - VST 3 (github.com)
- TrapezoidSynth 0.1.17 - VST 3 (github.com)
- TrapezoidSynth 0.1.16 - VST 3 (github.com)
- TrapezoidSynth 0.1.14 - VST 3 (github.com)
- TrapezoidSynth 0.1.13 - VST 3 (github.com)
- TrapezoidSynth 0.1.12 - VST 3 (github.com)
- TrapezoidSynth 0.1.10 - VST 3 (github.com)
- TrapezoidSynth 0.1.9 - VST 3 (github.com)
- TrapezoidSynth 0.1.8 - VST 3 (github.com)
- TrapezoidSynth 0.1.7 - VST 3 (github.com)
- TrapezoidSynth 0.1.5 - VST 3 (github.com)
- TrapezoidSynth 0.1.4 - VST 3 (github.com)
- TrapezoidSynth 0.1.3 - VST 3 (github.com)
- TrapezoidSynth 0.1.2 - VST 3 (github.com)

## License

TrapezoidSynth 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.