Getting Started with the Modular Subtractive Synthesizer
As a showcase of the traditional synthesis and DSP library that Aaron has developed, he created a Modular Subtractive Synthesizer.
Subtractive Synthesis is a type of synthesis where you start with a harmonically rich sound source (usually an oscillator or noise generator) and then carve away (like a sculpter) with filters and amplifier modulation.
In the Modular Synthesizer Aaron has designed, there are two oscillators/noise generators which sum into a filter and then an amplifier stage (then into an effects stage including a stereo delay and a chorus effect). A polyphonic voice manager allows multiple voices (effectively multiplying the two oscillators) to allow simultaneous voices at different pitches. There are modulators such as LFOs and a modulation envelope which allow you to shape the tone of your sound. As such, the synth provides a powerful showcase of the new and growing DSP library in the new Audio Engine and a wonderful example of how the more adventurous audio programmers out there might design their own Unreal Engine based synthesizer.
For practical purposes, this is designed as a component which can be added to an Actor and derives from the SoundBase object to allow all the game functional parameters we enjoy with SoundWave and SoundCue objects (such as spatialization and attenuation, sound classification, and our new effects processing section).
Adding a Modular Synth to an Actor
The Modular Synthesizer is a component which can be added to an existing actor or a custom Blueprint Actor.
The fastest way to get started is to do the following:
- Type “Modular Synth” in the Add Componet Dropdown menu search prompt to locate the Modular Synth component.
- While selected, in the **Details **panel, edit your Sound Base properties as needed.
Dynamically Setting Modular Synth Values in Blueprints
Subtractive Synthesizers are parametrically complex—but this complexity allows for an incredible diversity in modulation and sound shaping. You can drive changes to the synth properties via Blueprints as dozens of Set Functions have been implemented to safely pass values to the synthesizer. You can locate them in the Blueprint Function category **Synth > Components > Audio
Playing the Modular Synth in Blueprints
The Modular Synth was created with an nod toward traditional design and as such utilizes familiar MIDI-like Note On and Note Off functions.
Once you’ve initialized your synth with the preset values you want, you can activate the synth with the Note On function.
**Target **your modular synth component
**Note **is the MIDI note value expressed as a float value for inbetweens
Velocity is an implementation of a MIDI style volume scalar expressed as an integer from 0 to 127 (max)
**Duration **is an optional value. When less than 0, it will sustain indefinitely (or until another function stops it), when greater than 0, the note will play for that many seconds.
If you wish to use a Note Off event to dynamically control the timing of the note off, you may do so.
**Target **your modular synth component
**Note **is the MIDI note value you wish to turn off—this must be IDENTICAL to the note you turned on for the voice manager to correctly identify which note to turn off.
All Notes Off will turn all notes off regardless of which note was specified
Kill All Notes is like a MIDI Panic button, where it kills all voices rather than letting them release as normal.
Managing Modular Synth Presets in Blueprints
Managing individual parameters on a synth can be a bit finicky, so for establishing initial settings or for allowing a more streamlined approach to editing the synthesizer sounds, there is a Modular Synth Preset data structure encapsulating all of the relevant set data.
As a data structure, you can set all of your relevant synth parameters in a single Set Synth Preset function (and a single data struct input node).
From here you can **Make **or Break ModularSynthPreset data structures. You can create Blueprint variables, serialize them as a public variable, or procedurally set values in one go. It also allows you to store and pass these values in a single data type.[INDENT=2]
Creating a Modular Synth Preset Bank
Early on, it seemed apparent that storing and recalling** Modular Synth Presets** would be valuable, so Aaron designed a **Modular Synth Preset Bank **Asset Type that can be created in the content browser.
Right-click in the Content Browser and locate the **Sounds **submenu, then click on the Modular Synth Preset Bank
- Give your newly created Modular Synth Preset Bank a name
Double-click on the new Modular Synth Preset Bank asset.
- **Add **a Preset Entry Element
- Give your preset a name by filling in the** Preset Name **text field
- **Edit **your preset by expanding the > Preset data member and editing the values directly
A Modular Synth Preset Bank can have multiple presets and because each preset is accompanied by a name value, you can access Bank elements** by index** (like any other array) or** by name** comparison (via for loop).
Using a Modular Synth Preset Bank in Blueprints
Modular Synth Preset Banks are **Assets **that are essentially an array of Modular Synth Preset Bank Entries.
In order to access your asset from your content browser in your game, you will first need to establish a reference to your asset. The easiest way to do this is to create a Blueprint Variable that is a **Modular Synth Preset Bank Reference **and then access its data members via Blueprint functions.
- Add a Blueprint Variable of the type: **Modular Synth Preset Bank Reference
- **Compile **your **Blueprint **to expose default values
Add your Modular Synth Preset Bank as the Default Value (this can also be set in Blueprint Code)
- **Add **a reference to your new variable to your Blueprint
- Drag a node from the variable and Get Presets
- Drag a node from the Presets output array and Get (A Ref)
- **Enter **the index number for your desired Preset Entry
- **Drag **a node from the Get function into a Break ModularSynthPresetBankEntry
- Here you can grab the Preset data structure or you can compare names
At this stage, you can pass the **Preset **output into a Set Synth Preset function or you can pass it to another Blueprint for use in another part of your game, or you can break the structure out and query specific preset values.
Advanced Modular Patch Assignments - ADVANCED USERS ONLY -
One of the more advanced setting values is the Modular Patch system which allows you to set up arbitrary pairings between Modulation Sources and Modulation Destinations. Patches are a data structure, so they can be procedurally generated, you can **make **and **break **them in Blueprints, store them, pass them, etc.[INDENT=2]