This commit is contained in:
michalcourson
2025-11-04 20:13:19 -05:00
parent f5245eb557
commit cf0498a121
5 changed files with 28 additions and 4 deletions

View File

@ -48,6 +48,7 @@ function App() {
return (
<div>
<Container>
<JuceSlider identifier="harmonyMix" title="Mix" />
<JuceSlider identifier="formantPreserve" title="Formant" />
<JuceSlider identifier="autoTuneSpeed" title="Auto Tune Speed" />
<JuceSlider identifier="autoTuneDepth" title="Auto Tune Depth" />

View File

@ -66,6 +66,7 @@ void WebViewPluginAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer,
shifter.SetAutoTuneSpeed(state.getParameterAsValue("autoTuneSpeed").getValue());
shifter.SetAutoTuneDepth(state.getParameterAsValue("autoTuneDepth").getValue());
shifter.SetPortamentoTime(state.getParameterAsValue("portTime").getValue());
shifter.SetHarmonyMix(state.getParameterAsValue("harmonyMix").getValue());
juce::AudioBuffer<float> const_buff;
const_buff.makeCopyOf(buffer);
shifter.Process(const_buff.getArrayOfReadPointers(), (float**)buffer.getArrayOfWritePointers(), buffer.getNumSamples());

View File

@ -72,6 +72,14 @@ public:
"AutoTune Speed",
NormalisableRange<float> {0.001f, 0.1f, .001f},
.5f);
sliderIds.push_back("harmonyMix");
addToLayout<AudioParameterFloat>(layout,
ParameterID("harmonyMix"),
"Harmony Mix",
NormalisableRange<float> {0.0f, 1.0f, .01f},
.01f);
sliderIds.push_back("portTime");
addToLayout<AudioParameterFloat>(layout,
ParameterID("portTime"),

View File

@ -205,12 +205,12 @@ void Shifter::AddInterpolatedFrame(int voice, int max_index, float resampling_pe
float value = ((1 - interp) * in_buffer[(int)f_index] + (interp)*in_buffer[(int)(f_index + 1) % 8192]) * mult;
if(voice >= MAX_VOICES) {
//value *= volume;
out_buffer[0][out_index] += value;
out_buffer[1][out_index] += value;
out_buffer[0][out_index] += value * melody_mix;
out_buffer[1][out_index] += value * melody_mix;
} else {
value *= voices[voice].CurrentAmplitude() * volume;
out_buffer[0][out_index] += value * voices[voice].GetPanning(0);
out_buffer[1][out_index] += value * voices[voice].GetPanning(1);
out_buffer[0][out_index] += value * voices[voice].GetPanning(0) * harmony_mix;
out_buffer[1][out_index] += value * voices[voice].GetPanning(1) * harmony_mix;
}
@ -308,3 +308,14 @@ void Shifter::RemoveMidiNote(int note) {
}
}
}
void Shifter::SetHarmonyMix(float mix) {
if (mix < .5) {
melody_mix = 1.0f;
harmony_mix = mix * 2.0f;
}
else {
harmony_mix = 1.0f;
melody_mix = (1.0f - mix) * 2.0f;
}
}

View File

@ -156,6 +156,7 @@ public:
}
float getInputPitch() const { return sample_rate_ / in_period; }
float getOutputPitch() const { return sample_rate_ / out_period; }
void SetHarmonyMix(float mix);
float out_midi = 40;
ShifterVoice voices[MAX_VOICES];
@ -185,6 +186,8 @@ private:
double smear_step = 0.003;
bool onset_trigger = false;
bool pitch_trigger = false;
float harmony_mix = 0.0f;
float melody_mix = 0.0f;
int trigger_bank;