some app controls, format preserve, start of autotune speed
This commit is contained in:
@ -49,7 +49,7 @@ import PropTypes from "prop-types";
|
||||
import * as Juce from "juce-framework-frontend";
|
||||
|
||||
import "./App.css";
|
||||
import { KnobPercentage } from "./Components/KnobPercentage";
|
||||
// import { KnobPercentage } from "./Components/KnobPercentage";
|
||||
|
||||
// Custom attributes in React must be in all lower case
|
||||
const controlParameterIndexAnnotation = "controlparameterindex";
|
||||
@ -107,10 +107,6 @@ function JuceSlider({ identifier, title }) {
|
||||
<Typography sx={{ mt: 1.5 }}>
|
||||
{properties.name}: {sliderState.getScaledValue()} {properties.label}
|
||||
</Typography>
|
||||
<KnobPercentage theme="stone" label={properties.name} />
|
||||
<p>
|
||||
{sliderState.getScaledValue()} {properties.label}
|
||||
</p>
|
||||
<Slider
|
||||
aria-label={title}
|
||||
value={value}
|
||||
@ -423,7 +419,7 @@ function App() {
|
||||
<div>
|
||||
<Container>
|
||||
<JuceSlider identifier="formantSlider" title="Formant" />
|
||||
<JuceSlider identifier="cutoffSlider" title="Cutoff" />
|
||||
<JuceSlider identifier="autoTuneSpeedSlider" title="Auto Tune Speed" />
|
||||
</Container>
|
||||
<CardActions style={{ justifyContent: "center" }}>
|
||||
<Button
|
||||
|
||||
Binary file not shown.
@ -59,7 +59,8 @@ inline std::unique_ptr<InputStream> createAssetInputStream (const char* resource
|
||||
[[maybe_unused]] AssertAssetExists assertExists = AssertAssetExists::yes)
|
||||
{
|
||||
|
||||
auto assetsDir = File::getCurrentWorkingDirectory().getChildFile("..\\..\\Assets");
|
||||
// auto assetsDir = File::getCurrentWorkingDirectory().getChildFile("..\\..\\Assets");
|
||||
File assetsDir("C:\\Users\\mickl\\Desktop\\Plugins\\Harmonizer\\Assets");
|
||||
|
||||
auto resourceFile = assetsDir.getChildFile (resourcePath);
|
||||
|
||||
|
||||
@ -100,11 +100,19 @@ void Shifter::DetectPitch(const float* const* in, float** out, size_t size)
|
||||
float in_freq = 48000 / in_period;
|
||||
|
||||
int midi = (int)(12 * log2f(in_freq / 440) + 69.5f);
|
||||
out_midi[MAX_VOICES] = midi;
|
||||
|
||||
static float out_period_filter_amount = 0.7f; // You can expose this as a parameter
|
||||
float target_out_period = 48000.0f / mtof(midi);
|
||||
out_periods[MAX_VOICES] = out_periods[MAX_VOICES] * out_period_filter_amount + target_out_period * (1.0f - out_period_filter_amount);
|
||||
|
||||
if (midi != last_autotune_midi) {
|
||||
last_autotune_midi = midi;
|
||||
out_periods[MAX_VOICES] = in_period;
|
||||
}
|
||||
|
||||
float error = target_out_period - out_periods[MAX_VOICES];
|
||||
float adjustment = error * out_period_filter_amount;
|
||||
|
||||
//target_out_period = in_period * out_period_filter_amount + target_out_period * (1 - out_period_filter_amount);
|
||||
out_midi[MAX_VOICES] = midi;
|
||||
out_periods[MAX_VOICES] += adjustment;
|
||||
}
|
||||
|
||||
void Shifter::SetRates() {}
|
||||
|
||||
@ -82,6 +82,7 @@ public:
|
||||
void AddMidiNote(int note);
|
||||
void RemoveMidiNote(int note);
|
||||
void SetFormantPreserve(float val) { formant_preserve = val; }
|
||||
void SetAutoTuneSpeed(float val) { out_period_filter_amount = 1 - val; }
|
||||
|
||||
int out_midi[MAX_VOICES + 1] = { -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1 };
|
||||
|
||||
@ -129,6 +130,9 @@ private:
|
||||
float out_buffer[2][BUFFER_SIZE];
|
||||
int out_playhead = 0;
|
||||
int in_playhead = 0;
|
||||
int last_autotune_midi = -1;
|
||||
|
||||
float out_period_filter_amount = 0.7f; // You can expose this as a parameter
|
||||
|
||||
float out_periods[MAX_VOICES + 1] = { 0,0,0,0,0,0,0,0,0,0,0,0 }; //C3
|
||||
float out_panning[MAX_VOICES + 1] = { 0,0,0,0,0,0,0,0,0,0,0,.5 }; //C3
|
||||
|
||||
@ -63,6 +63,7 @@ namespace ID
|
||||
#define PARAMETER_ID(str) static const ParameterID str { #str, 1 };
|
||||
|
||||
PARAMETER_ID(formantPreserve)
|
||||
PARAMETER_ID(autoTuneSpeed)
|
||||
PARAMETER_ID(mute)
|
||||
PARAMETER_ID(filterType)
|
||||
|
||||
@ -210,7 +211,7 @@ public:
|
||||
.5f)),
|
||||
|
||||
autoTuneSpeed(addToLayout<AudioParameterFloat>(layout,
|
||||
ID::formantPreserve,
|
||||
ID::autoTuneSpeed,
|
||||
"AutoTune Speed",
|
||||
NormalisableRange<float> {0.0f, 1.0f, .01f},
|
||||
.5f)),
|
||||
@ -318,6 +319,7 @@ void WebViewPluginAudioProcessor::processBlock(juce::AudioBuffer<float>& buffer,
|
||||
for (auto i = totalNumInputChannels; i < totalNumOutputChannels; ++i)
|
||||
buffer.clear(i, 0, buffer.getNumSamples());
|
||||
shifter.SetFormantPreserve(parameters.formantPreserve.get());
|
||||
shifter.SetAutoTuneSpeed(parameters.autoTuneSpeed.get());
|
||||
juce::AudioBuffer<float> const_buff;
|
||||
const_buff.makeCopyOf(buffer);
|
||||
shifter.Process(const_buff.getArrayOfReadPointers(), (float**)buffer.getArrayOfWritePointers(), buffer.getNumSamples());
|
||||
@ -463,6 +465,7 @@ private:
|
||||
WebViewPluginAudioProcessor& processorRef;
|
||||
|
||||
WebSliderRelay formantSliderRelay{ "formantSlider" };
|
||||
WebSliderRelay autoTuneSpeedSliderRelay{ "autoTuneSpeedSlider" };
|
||||
WebToggleButtonRelay muteToggleRelay{ "muteToggle" };
|
||||
WebComboBoxRelay filterTypeComboRelay{ "filterTypeCombo" };
|
||||
|
||||
@ -474,6 +477,7 @@ private:
|
||||
.withUserDataFolder(File::getSpecialLocation(File::SpecialLocationType::tempDirectory)))
|
||||
.withNativeIntegrationEnabled()
|
||||
.withOptionsFrom(formantSliderRelay)
|
||||
.withOptionsFrom(autoTuneSpeedSliderRelay)
|
||||
.withOptionsFrom(muteToggleRelay)
|
||||
.withOptionsFrom(filterTypeComboRelay)
|
||||
.withOptionsFrom(controlParameterIndexReceiver)
|
||||
@ -488,6 +492,7 @@ private:
|
||||
URL { localDevServerAddress }.getOrigin()) };
|
||||
|
||||
WebSliderParameterAttachment formantAttachment;
|
||||
WebSliderParameterAttachment autoTuneSpeedAttachment;
|
||||
WebToggleButtonParameterAttachment muteAttachment;
|
||||
WebComboBoxParameterAttachment filterTypeAttachment;
|
||||
|
||||
@ -616,6 +621,9 @@ WebViewPluginAudioProcessorEditor::WebViewPluginAudioProcessorEditor(WebViewPlug
|
||||
formantAttachment(*processorRef.state.getParameter(ID::formantPreserve.getParamID()),
|
||||
formantSliderRelay,
|
||||
processorRef.state.undoManager),
|
||||
autoTuneSpeedAttachment(*processorRef.state.getParameter(ID::autoTuneSpeed.getParamID()),
|
||||
autoTuneSpeedSliderRelay,
|
||||
processorRef.state.undoManager),
|
||||
muteAttachment(*processorRef.state.getParameter(ID::mute.getParamID()),
|
||||
muteToggleRelay,
|
||||
processorRef.state.undoManager),
|
||||
@ -625,8 +633,8 @@ WebViewPluginAudioProcessorEditor::WebViewPluginAudioProcessorEditor(WebViewPlug
|
||||
{
|
||||
addAndMakeVisible(webComponent);
|
||||
|
||||
webComponent.goToURL(localDevServerAddress);
|
||||
//webComponent.goToURL (WebBrowserComponent::getResourceProviderRoot());
|
||||
//webComponent.goToURL(localDevServerAddress);
|
||||
webComponent.goToURL (WebBrowserComponent::getResourceProviderRoot());
|
||||
|
||||
setSize(500, 500);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user