mirror of
https://codeberg.org/armin/chromaflock.git
synced 2026-09-01 04:10:47 +02:00
Tune synth down one octave; add LFO1/LFO2 OSC2 phase destination
This commit is contained in:
parent
1abf4f4b60
commit
a8928fc6a4
3 changed files with 13 additions and 4 deletions
|
|
@ -1,7 +1,7 @@
|
|||
#pragma once
|
||||
#include <cmath>
|
||||
|
||||
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 {
|
||||
|
|
|
|||
|
|
@ -38,9 +38,11 @@ public:
|
|||
lfo2.reset();
|
||||
|
||||
baseFreq1 = 440.0f * std::pow(2.0f, (static_cast<float>(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<float>(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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue