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 261 of file WaveguideNetwork.cpp.

262{
263 position = std::clamp(position, 0.01, 0.99);
264
267 m_exciter_duration = 0.002;
269 }
270
271 if (m_segments.empty())
272 return;
273
274 auto& seg = m_segments[0];
275 const size_t len = m_delay_length_integer;
276 const auto strike_center = static_cast<size_t>(position * static_cast<double>(len));
277 const size_t burst_width = std::max<size_t>(len / 10, 4);
278 const double effective_strength = (m_exciter_type == ExciterType::CONTINUOUS)
279 ? std::max(strength, 1.0)
280 : strength;
281
282 seg.p_plus = Memory::HistoryBuffer<double>(seg.p_plus.capacity());
283 seg.p_minus = Memory::HistoryBuffer<double>(seg.p_minus.capacity());
284
285 for (size_t s = 0; s < len; ++s) {
286 const double dist = std::abs(static_cast<double>(s)
287 - static_cast<double>(strike_center));
288 const double window = std::exp(-(dist * dist)
289 / (2.0 * static_cast<double>(burst_width * burst_width)));
290 seg.p_plus.push(effective_strength * m_random_generator(-1.0, 1.0) * window);
291 }
292
294 m_exciter_active = false;
296 }
297}
Kinesis::Stochastic::Stochastic m_random_generator
@ CONTINUOUS
External node as continuous exciter (bowing)
@ NOISE_BURST
Short white noise burst (default for pluck)
std::vector< WaveguideSegment > m_segments

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

+ Here is the call graph for this function: