It’s been almost three years since I started work on my “monster” synthesizer, although I’ve been only working daily for about half that time.
The last few weeks I have been optimizing and reorganizing variables and components, saving about 7% of memory used while running, not counting increased speed.
My SynthVoice.h file is about 9300 lines of code (not using a cpp file). I can clearly see from other JUCE synths where source code has been public, that my length is much longer than those. But keep in mind that mine has the following features, all working smoothly;
Please feel free to skip this part of go towards the end of this post, to read my actual question.
- 8 Tone Generators.
- 8 “Engines” assignable to any tone generator; Wavetable (Look Up Table), Additive (Only 4 parts, but each part any type of millions of waveforms, frequency, and level), Spiral (FM type sounds), Analog Curve . Plus the following wavetable variations; Transwave (Grain type), Splitwave, Scrambler (Vertical grainer), and Wavemix Table.
Each tone generator’s engine tweakable by the following;
- Each engine up to 16 Unison voices.
- Adjustable phase start and end.
- Phase Cycle Start Mode and Unison Phase Cycle Spread
- 4 Frequency Modes; Normal FM range note related, Fixed FM range, LFO range note related, LFO fixed range.
- 5 Portamento Modes each with or without Legato, and each with 3 frequency variations.
- 6 Hard Sync Modes from any other tone generator.
- Span - Real time extending a tone generator’s waveform to span into other tone generator’s waveform.
- 20 Phase Distortion Modes some allowing special adjustment, all with Unison Spread adjustment, and adjusting level (Two modes allows for Pulse Width on any waveform).
- Unison Modulation; 4 AM Modes, RM, ARM (AM + RM), FM, FM Feedback 1, FM Feedback 2, Feedback SFX, and PM.
- Unison Fidelity tweaking for special sounds/effects.
- 4 Noise Modes which can be set to effect either unison voices individually or combined.
- Tone Generator Modulation (Combined Unison voices); 4 AM Modes, RM, and ARM.
- Dynamic Mixer between any two other tone generators, off course assignable to envelope and/or LFO.
- 5 Morphing Types (Morphing from one tone generator to another), each 6 frequency mode, plus adjustable rate.
8 Envelopes - Six stages, each with adjustable modulation (Rate and level), and with start and end levels adjustable for inverted envelope types.
8 Effect Slots - Assignable to one of the following effect modules and assignable to any tone generator(s); Bitcrusher (6 Types), Chorus (1-5 Stages), Stereo Delay, Distortion (34 Types) each with a type of cross modulation to any other tone generator, and most of them with 5 cross source variations, Flanger, Phaser (2-32 Stages), Reverb, Stereorizer (3 Types), and Waveshaper (37 Types) each with a type of cross modulation to any other tone generator. Most effects has it’s own filtering of wet level (LP, BP, HP, AP, and Comb). Bitcrusher, Distortion, and Waveshaper can each be assigned on a Voice Unison Level, Voice Combined Unison (Note) Level, Tone Generator Level (Combined tone generator notes), or Global (Combined notes and tone generators).
8 LFO’s - Each with simple 50000+ Waveform creator, Depth assignable to any envelope.
8 Filter’s - Each with Low Pass, Band Pass, Dual Band Pass, High Pass, each from 6db to 36db, plus 12 stage All Pass, and 12 stage Comb. Each filter can be assigned to any on or multiple tone generators. Envelope and/or LFO assignable to cutoff, resonance, plus dry/wet mix.
Most parameters can be assigned to any envelope and/or any LFO.
Except for the Chorus, Delay, Flanger, Phaser, and Stereorizer which code resides in PluginProcessor, all code is in SynthVoice.
I do not use SynthesiserSound / SynthSound.h at all. I read in the description of the SynthesiserSound class that; “Describes one of the sounds that a Synthesiser can play”.
Now the following is meant as a joke.
Does this mean I should put a text String in my SynthSound.h file writing “Yeah this is a cool saw buzz type sound, that can be manipulated in a gazillion ways, jadi, jadi, jadi…”?
No off course not! So can anyone please give me an example, a link perhaps, to what I can use SynthSound for? From the class description it does not seem I can put any of my sound creation code in it, or can I?
Also without having seen my code, is there any other obvious ways I should reduce my SynthVoice code length? Some DSP code are shared in a separate class file, since it can be used by both SynthVoice and PluginProcessor, but back when I did so it did not reduce the memory consumption of my plugin, perhaps because all external functions where inlined into SynthVoice.h?
Here is “old” Youtube video demonstration, but keep in mind I have done a lot since!