From a8928fc6a47dffcd6a65c64b9b67329e13e70ff0 Mon Sep 17 00:00:00 2001 From: Armin Date: Wed, 15 Jul 2026 23:51:58 +0200 Subject: [PATCH] Tune synth down one octave; add LFO1/LFO2 OSC2 phase destination --- Source/DSP/LFO.h | 2 +- Source/DSP/Voice.h | 13 +++++++++++-- Source/PluginEditor.cpp | 2 +- 3 files changed, 13 insertions(+), 4 deletions(-) diff --git a/Source/DSP/LFO.h b/Source/DSP/LFO.h index 83185a0..bf7c00e 100644 --- a/Source/DSP/LFO.h +++ b/Source/DSP/LFO.h @@ -1,7 +1,7 @@ #pragma once #include -enum class LFODest { FilterCutoff = 0, OSC1Freq, OSC2Freq, BothOsc }; +enum class LFODest { FilterCutoff = 0, OSC1Freq, OSC2Freq, BothOsc, OSC2Phase }; enum class LFOShape { Sine = 0, Triangle, Saw, Square }; class LFO { diff --git a/Source/DSP/Voice.h b/Source/DSP/Voice.h index 0ed929d..41a4b2d 100644 --- a/Source/DSP/Voice.h +++ b/Source/DSP/Voice.h @@ -38,9 +38,11 @@ public: lfo2.reset(); baseFreq1 = 440.0f * std::pow(2.0f, (static_cast(midiNoteNumber) - 69.0f) / 12.0f) - * std::pow(2.0f, semitone1 / 12.0f + fineTune1 / 1200.0f) * std::pow(2.0f, octave1); + * std::pow(2.0f, semitone1 / 12.0f + fineTune1 / 1200.0f) * std::pow(2.0f, octave1) + * globalTune; baseFreq2 = 440.0f * std::pow(2.0f, (static_cast(midiNoteNumber) - 69.0f) / 12.0f) - * std::pow(2.0f, semitone2 / 12.0f + fineTune2 / 1200.0f) * std::pow(2.0f, octave2); + * std::pow(2.0f, semitone2 / 12.0f + fineTune2 / 1200.0f) * std::pow(2.0f, octave2) + * globalTune; osc1.setFrequency(baseFreq1); osc2.setFrequency(baseFreq2); @@ -113,6 +115,12 @@ public: osc1.setFrequency(freq1); osc2.setFrequency(freq2); + // Apply LFO to OSC2 phase (vibrato-style phase sweep) + if (lfo1Depth > 0.001f && lfo1Dest == LFODest::OSC2Phase) + osc2.setPhase(phaseOffset2 + lfo1Out * 0.5f); + if (lfo2Depth > 0.001f && lfo2Dest == LFODest::OSC2Phase) + osc2.setPhase(phaseOffset2 + lfo2Out * 0.5f); + float left = 0.0f, right = 0.0f; osc1.process(&left, &right); osc2.process(&left, &right); @@ -243,6 +251,7 @@ private: float outputLevel = 0.8f; float baseFreq1 = 440.0f; float baseFreq2 = 440.0f; + float globalTune = 0.5f; // synth tuned down one octave (1/2 of normal pitch) float lfo1Depth = 0.0f; float lfo2Depth = 0.0f; LFODest lfo1Dest = LFODest::FilterCutoff; diff --git a/Source/PluginEditor.cpp b/Source/PluginEditor.cpp index 535c1b9..d2e74b7 100644 --- a/Source/PluginEditor.cpp +++ b/Source/PluginEditor.cpp @@ -505,7 +505,7 @@ MainContentComponent::MainContentComponent(ChromaFlockProcessor& p) setupKnob(lfo2RateKnob, "RATE"); setupParam(lfo2DepthKnob, lfo2DepthAttach, "lfo2Depth", "DEPTH"); setupCB(lfo2ShapeBox, lfo2ShapeAttach, "lfo2Shape", {"Sine", "Triangle", "Saw", "Square"}); - setupCB(lfo2DestBox, lfo2DestAttach, "lfo2Dest", {"Filter", "OSC1", "OSC2", "Both OSC"}); + setupCB(lfo2DestBox, lfo2DestAttach, "lfo2Dest", {"Filter", "OSC1", "OSC2", "Both OSC", "OSC2 Phase"}); setupCB(lfo2SyncBox, lfo2SyncAttach, "lfo2Sync", {"Sync Off", "Sync On"}); lfo2SyncBox.onChange = [this]() { setupSyncKnob(lfo2RateKnob, lfo2RateAttach, lfo2BeatAttach, "lfo2Rate", "lfo2Beat", lfo2SyncBox);