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

201{
202 position = std::clamp(position, 0.01, 0.99);
203
204 if (m_segments.empty()) {
205 return;
206 }
207
208 auto& seg = m_segments[0];
209 const size_t len = m_delay_length_integer;
210 const auto pluck_sample = static_cast<size_t>(position * static_cast<double>(len));
211
212 seg.p_plus = Memory::HistoryBuffer<double>(seg.p_plus.capacity());
213 seg.p_minus = Memory::HistoryBuffer<double>(seg.p_minus.capacity());
214
215 for (size_t s = 0; s < len; ++s) {
216 double value = 0.0;
217 if (s <= pluck_sample) {
218 value = strength * static_cast<double>(s)
219 / static_cast<double>(pluck_sample);
220 } else {
221 value = strength * static_cast<double>(len - s)
222 / static_cast<double>(len - pluck_sample);
223 }
224 seg.p_plus.push(value);
225 }
226
227 m_exciter_active = false;
229}
std::vector< WaveguideSegment > m_segments

References m_delay_length_integer, m_exciter_active, m_exciter_samples_remaining, and m_segments.