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" /> <JuceSlider identifier="portTime" title="Portamento Speed" />
<JuceCheckbox identifier="freezeEnabled" /> <JuceCheckbox identifier="freezeEnabled" />
<JuceSlider identifier="freezePitch" title="Freeze Pitch" />
<JuceSlider identifier="freezeVolume" title="Freeze Volume" />
</Container> </Container>
<MidiNoteInfo /> <MidiNoteInfo />
</div> </div>

View File

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

View File

@ -86,6 +86,20 @@ public:
"Portamento Speed", "Portamento Speed",
NormalisableRange<float> {0.001f, 0.2f, .001f}, NormalisableRange<float> {0.001f, 0.2f, .001f},
.01f); .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"); toggleIds.push_back("autoTuneEnabled");

View File

@ -215,7 +215,7 @@ void Shifter::GetSamples(float** output, const float* input, size_t size)
if (voices[i].IsActive()) { if (voices[i].IsActive()) {
freeze_voices[i].Trigger(voices[i].GetMidiNote()); freeze_voices[i].Trigger(voices[i].GetMidiNote());
freeze_voices[i].panning = voices[i].panning; freeze_voices[i].panning = voices[i].panning;
freeze_voices[i].SetPortamentoTime(0.0001f); freeze_voices[i].SetPortamentoTime(0.05f);
} }
} }
} }
@ -402,4 +402,10 @@ void Shifter::SetFreeze(bool freeze) {
} }
} }
freeze_mode = 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 SetHarmonyMix(float mix);
void SetAutoTuneEnable(bool enable) { enable_autotune = enable; } void SetAutoTuneEnable(bool enable) { enable_autotune = enable; }
void SetFreeze(bool); void SetFreeze(bool);
void SetFreezePitchAdjust(float val);
void SetFreezeVolume(float val) { freeze_volume = val; }
float out_midi = 40; float out_midi = 40;
ShifterVoice voices[MAX_VOICES]; ShifterVoice voices[MAX_VOICES];

View File

@ -54,7 +54,7 @@ void ShifterVoice::Release() {
void ShifterVoice::Process() { void ShifterVoice::Process() {
current_amplitude = amplitude_envelope_.Process(onoff_); 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++; period_counter++;
overflow_ = period_counter >= current_period_; overflow_ = period_counter >= current_period_;
if (overflow_) { if (overflow_) {
@ -93,4 +93,8 @@ float ShifterVoice::GetPanning(int channel) const {
case 1: case 1:
return panning > .5 ? 1.0 : panning * 2.0f; 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); void SetAdsrTimes(float attack, float decay, float release);
float GetPanning(int channel) const; float GetPanning(int channel) const;
int GetMidiNote() const { return current_midi; } int GetMidiNote() const { return current_midi; }
void SetPitchAdjust(float);
bool onoff_; bool onoff_;
float panning; float panning;
@ -46,5 +47,6 @@ private:
float current_period_; float current_period_;
float current_amplitude; float current_amplitude;
float period_counter; float period_counter;
float pitch_adjust = 0.0f;
}; };