MayaFlux 0.2.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 231 of file WaveguideNetwork.cpp.

232{
233 position = std::clamp(position, 0.01, 0.99);
234
236 m_exciter_duration = 0.002;
237
239
240 if (m_segments.empty()) {
241 return;
242 }
243
244 auto& seg = m_segments[0];
245 const size_t len = m_delay_length_integer;
246 const auto strike_center = static_cast<size_t>(position * static_cast<double>(len));
247 const size_t burst_width = std::max<size_t>(len / 10, 4);
248
249 seg.p_plus = Memory::HistoryBuffer<double>(seg.p_plus.capacity());
250 seg.p_minus = Memory::HistoryBuffer<double>(seg.p_minus.capacity());
251
252 for (size_t s = 0; s < len; ++s) {
253 const double dist = std::abs(static_cast<double>(s)
254 - static_cast<double>(strike_center));
255 const double window = std::exp(-(dist * dist)
256 / (2.0 * static_cast<double>(burst_width * burst_width)));
257 seg.p_plus.push(strength * m_random_generator(-1.0, 1.0) * window);
258 }
259
260 m_exciter_active = false;
262}
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, and NOISE_BURST.

+ Here is the call graph for this function: