39 init_effect_details();
44 fft_size(new_fft_size), hop_size(new_hop_size), window_type(new_window_type), stft(*this)
47 init_effect_details();
51void Whisperization::init_effect_details()
59 info.
description =
"Transform the voice present in an audio track into a whispering voice effect.";
68 const ScopedLock sl (
lock);
69 ScopedNoDenormals noDenormals;
71 const int num_input_channels = frame->audio->getNumChannels();
72 const int num_output_channels = frame->audio->getNumChannels();
73 const int num_samples = frame->audio->getNumSamples();
74 const int hop_size_value = 1 << ((int)
hop_size + 1);
75 const int fft_size_value = 1 << ((int)
fft_size + 5);
88void Whisperization::WhisperizationEffect::modification(
const int channel)
92 for (
int index = 0; index <
fft_size / 2 + 1; ++index) {
94 float phase = 2.0f * M_PI * (float)rand() / (float)RAND_MAX;
99 if (index > 0 && index <
fft_size / 2) {
140 catch (
const std::exception& e)
143 throw InvalidJSON(
"JSON is invalid (missing keys or invalid data types)");
153 if (!root[
"fft_size"].isNull())
156 if (!root[
"hop_size"].isNull())
159 if (!root[
"window_type"].isNull())
168 root[
"id"] =
add_property_json(
"ID", 0.0,
"string",
Id(), NULL, -1, -1,
true, requested_frame);
170 root[
"start"] =
add_property_json(
"Start",
Start(),
"float",
"", NULL, 0, 1000 * 60 * 30,
false, requested_frame);
171 root[
"end"] =
add_property_json(
"End",
End(),
"float",
"", NULL, 0, 1000 * 60 * 30,
false, requested_frame);
172 root[
"duration"] =
add_property_json(
"Duration",
Duration(),
"float",
"", NULL, 0, 1000 * 60 * 30,
true, requested_frame);
199 return root.toStyledString();
Header file for all Exception classes.
Header file for whisperization audio effect class.
float End() const
Get end position (in seconds) of clip (trim end of video)
float Start() const
Get start position (in seconds) of clip (trim start of video)
float Duration() const
Get the length of this clip (in seconds)
std::string Id() const
Get the Id of this clip object.
Json::Value add_property_choice_json(std::string name, int value, int selected_value) const
Generate JSON choice for a property (dropdown properties)
int Layer() const
Get layer of clip on timeline (lower number is covered by higher numbers)
Json::Value add_property_json(std::string name, float value, std::string type, std::string memo, const Keyframe *keyframe, float min_value, float max_value, bool readonly, int64_t requested_frame) const
Generate JSON for a property.
virtual Json::Value JsonValue() const
Generate Json::Value for this object.
virtual void SetJsonValue(const Json::Value root)
Load Json::Value into this object.
EffectInfoStruct info
Information about the current effect.
Exception for invalid JSON.
void setup(const int num_input_channels)
void process(juce::AudioSampleBuffer &block)
juce::HeapBlock< juce::dsp::Complex< float > > frequency_domain_buffer
std::unique_ptr< juce::dsp::FFT > fft
void updateParameters(const int new_fft_size, const int new_overlap, const int new_window_type)
juce::HeapBlock< juce::dsp::Complex< float > > time_domain_buffer
std::shared_ptr< openshot::Frame > GetFrame(int64_t frame_number) override
This method is required for all derived classes of ClipBase, and returns a new openshot::Frame object...
void SetJsonValue(const Json::Value root) override
Load Json::Value into this object.
Whisperization()
Blank constructor, useful when using Json to load the effect properties.
std::string Json() const override
Generate JSON string of this object.
openshot::WindowType window_type
juce::CriticalSection lock
WhisperizationEffect stft
Json::Value JsonValue() const override
Generate Json::Value for this object.
std::string PropertiesJSON(int64_t requested_frame) const override
void SetJson(const std::string value) override
Load JSON string into this object.
openshot::FFTSize fft_size
openshot::HopSize hop_size
This namespace is the default namespace for all code in the openshot library.
FFTSize
This enumeration determines the FFT size.
HopSize
This enumeration determines the hop size.
WindowType
This enumeration determines the window type.
const Json::Value stringToJson(const std::string value)
bool has_video
Determines if this effect manipulates the image of a frame.
bool has_audio
Determines if this effect manipulates the audio of a frame.
std::string class_name
The class name of the effect.
std::string name
The name of the effect.
std::string description
The description of this effect and what it does.