MCPcopy Create free account
hub / github.com/OpenShot/libopenshot / modification

Method modification

src/audio_effects/Whisperization.cpp:71–89  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71void Whisperization::WhisperizationEffect::modification(const int channel)
72{
73 fft->perform(time_domain_buffer, frequency_domain_buffer, false);
74
75 for (int index = 0; index < fft_size / 2 + 1; ++index) {
76 float magnitude = abs(frequency_domain_buffer[index]);
77 float phase = 2.0f * M_PI * (float)rand() / (float)RAND_MAX;
78
79 frequency_domain_buffer[index].real(magnitude * cosf(phase));
80 frequency_domain_buffer[index].imag(magnitude * sinf(phase));
81
82 if (index > 0 && index < fft_size / 2) {
83 frequency_domain_buffer[fft_size - index].real(magnitude * cosf (phase));
84 frequency_domain_buffer[fft_size - index].imag(magnitude * sinf (-phase));
85 }
86 }
87
88 fft->perform(frequency_domain_buffer, time_domain_buffer, true);
89}
90
91
92// Generate JSON string of this object

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected