Added freeze pitch and volume controls
This commit is contained in:
michalcourson
2025-11-05 19:17:34 -05:00
parent f4a0b995ba
commit e89620df27
7 changed files with 34 additions and 2 deletions

View File

@ -57,6 +57,8 @@ function App() {
<JuceSlider identifier="portTime" title="Portamento Speed" />
<JuceCheckbox identifier="freezeEnabled" />
<JuceSlider identifier="freezePitch" title="Freeze Pitch" />
<JuceSlider identifier="freezeVolume" title="Freeze Volume" />
</Container>
<MidiNoteInfo />
</div>

View File

@ -69,6 +69,8 @@ void WebViewPluginAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer,
shifter.SetHarmonyMix(state.getParameterAsValue("harmonyMix").getValue());
shifter.SetAutoTuneEnable(state.getParameterAsValue("autoTuneEnabled").getValue());
shifter.SetFreeze(state.getParameterAsValue("freezeEnabled").getValue());
shifter.SetFreezePitchAdjust(state.getParameterAsValue("freezePitch").getValue());
shifter.SetFreezeVolume(state.getParameterAsValue("freezeVolume").getValue());
juce::AudioBuffer<float> const_buff;
const_buff.makeCopyOf(buffer);

View File

@ -87,6 +87,20 @@ public:
NormalisableRange<float> {0.001f, 0.2f, .001f},
.01f);
sliderIds.push_back("freezePitch");
addToLayout<AudioParameterFloat>(layout,
ParameterID("freezePitch"),
"Freeze pitch",
NormalisableRange<float> {-12.0f, 12.0f, 1.00f},
0.0f);
sliderIds.push_back("freezeVolume");
addToLayout<AudioParameterFloat>(layout,
ParameterID("freezeVolume"),
"Freeze Volume",
NormalisableRange<float> {0.0f, 1.0f, .01f},
0.5f);
toggleIds.push_back("autoTuneEnabled");
addToLayout<AudioParameterBool>(layout,

View File

@ -215,7 +215,7 @@ void Shifter::GetSamples(float** output, const float* input, size_t size)
if (voices[i].IsActive()) {
freeze_voices[i].Trigger(voices[i].GetMidiNote());
freeze_voices[i].panning = voices[i].panning;
freeze_voices[i].SetPortamentoTime(0.0001f);
freeze_voices[i].SetPortamentoTime(0.05f);
}
}
}
@ -403,3 +403,9 @@ void Shifter::SetFreeze(bool freeze) {
}
freeze_mode = freeze;
}
void Shifter::SetFreezePitchAdjust(float val) {
for(int i = 0; i < MAX_VOICES; ++i) {
freeze_voices[i].SetPitchAdjust(val);
}
}

View File

@ -159,6 +159,8 @@ public:
void SetHarmonyMix(float mix);
void SetAutoTuneEnable(bool enable) { enable_autotune = enable; }
void SetFreeze(bool);
void SetFreezePitchAdjust(float val);
void SetFreezeVolume(float val) { freeze_volume = val; }
float out_midi = 40;
ShifterVoice voices[MAX_VOICES];

View File

@ -54,7 +54,7 @@ void ShifterVoice::Release() {
void ShifterVoice::Process() {
current_amplitude = amplitude_envelope_.Process(onoff_);
current_period_ = sample_rate_ / mtof(portamento_.Process((float)current_midi));
current_period_ = sample_rate_ / mtof(portamento_.Process((float)current_midi + pitch_adjust));
period_counter++;
overflow_ = period_counter >= current_period_;
if (overflow_) {
@ -94,3 +94,7 @@ float ShifterVoice::GetPanning(int channel) const {
return panning > .5 ? 1.0 : panning * 2.0f;
}
}
void ShifterVoice::SetPitchAdjust(float adj) {
pitch_adjust = adj;
}

View File

@ -32,6 +32,7 @@ public:
void SetAdsrTimes(float attack, float decay, float release);
float GetPanning(int channel) const;
int GetMidiNote() const { return current_midi; }
void SetPitchAdjust(float);
bool onoff_;
float panning;
@ -46,5 +47,6 @@ private:
float current_period_;
float current_amplitude;
float period_counter;
float pitch_adjust = 0.0f;
};