MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ strike()

void MayaFlux::Nodes::Network::WaveguideNetwork::strike ( double  position = 0.5,
double  strength = 1.0 
)

Strike the string/tube with an impulse.

Parameters
positionNormalized strike position
strengthExcitation amplitude

Definition at line 239 of file WaveguideNetwork.cpp.

240{
241 position = std::clamp(position, 0.01, 0.99);
242
244 m_exciter_duration = 0.002;
245
247
248 if (m_segments.empty()) {
249 return;
250 }
251
252 auto& seg = m_segments[0];
253 const size_t len = m_delay_length_integer;
254 const auto strike_center = static_cast<size_t>(position * static_cast<double>(len));
255 const size_t burst_width = std::max<size_t>(len / 10, 4);
256
257 seg.p_plus = Memory::HistoryBuffer<double>(seg.p_plus.capacity());
258 seg.p_minus = Memory::HistoryBuffer<double>(seg.p_minus.capacity());
259
260 for (size_t s = 0; s < len; ++s) {
261 const double dist = std::abs(static_cast<double>(s)
262 - static_cast<double>(strike_center));
263 const double window = std::exp(-(dist * dist)
264 / (2.0 * static_cast<double>(burst_width * burst_width)));
265 seg.p_plus.push(strength * m_random_generator(-1.0, 1.0) * window);
266 }
267
268 m_exciter_active = false;
270}
glm::vec3 position
Kinesis::Stochastic::Stochastic m_random_generator
@ NOISE_BURST
Short white noise burst (default for pluck)
std::vector< WaveguideSegment > m_segments

References initialize_exciter(), m_delay_length_integer, m_exciter_active, m_exciter_duration, m_exciter_samples_remaining, m_exciter_type, m_random_generator, m_segments, NOISE_BURST, and position.

+ Here is the call graph for this function: