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

◆ pluck()

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

Pluck the string at a normalized position.

Parameters
positionNormalized position along string (0.0 to 1.0)
strengthExcitation amplitude (0.0 to 1.0+)

Fills the delay line with a shaped noise burst. Position affects spectral content: 0.5 = center (warm), near 0/1 = bridge (bright).

Definition at line 226 of file WaveguideNetwork.cpp.

227{
228 position = std::clamp(position, 0.01, 0.99);
229
230 if (m_segments.empty())
231 return;
232
233 auto& seg = m_segments[0];
234 const size_t len = m_delay_length_integer;
235 const auto pluck_sample = static_cast<size_t>(position * static_cast<double>(len));
236 const double effective_strength = (m_exciter_type == ExciterType::CONTINUOUS)
237 ? std::max(strength, 1.0)
238 : strength;
239
240 seg.p_plus = Memory::HistoryBuffer<double>(seg.p_plus.capacity());
241 seg.p_minus = Memory::HistoryBuffer<double>(seg.p_minus.capacity());
242
243 for (size_t s = 0; s < len; ++s) {
244 double value = 0.0;
245 if (s <= pluck_sample) {
246 value = effective_strength * static_cast<double>(s)
247 / static_cast<double>(pluck_sample);
248 } else {
249 value = effective_strength * static_cast<double>(len - s)
250 / static_cast<double>(len - pluck_sample);
251 }
252 seg.p_plus.push(value);
253 }
254
256 m_exciter_active = false;
258 }
259}
@ CONTINUOUS
External node as continuous exciter (bowing)
std::vector< WaveguideSegment > m_segments

References CONTINUOUS, m_delay_length_integer, m_exciter_active, m_exciter_samples_remaining, m_exciter_type, and m_segments.