Pulp 1.88.0
Cross-platform audio plugin framework
Loading...
Searching...
No Matches
pulp::signal::ProbGateT< SampleType > Class Template Reference

Passes each incoming trigger with a stated probability, deterministically. More...

#include <probability_gate.hpp>

Public Member Functions

 ProbGateT ()
void prepare (double)
void set_probability (double p)
double probability () const
void set_seed (std::uint32_t seed)
void apply_reset_edge ()
 Verb 2: clears the edge-detector latch only. The RNG stream is untouched.
void reset ()
 Verb 1: clears the latch and rewinds the stream to the seed.
std::uint32_t draw_count () const
 Number of draws consumed since the last reset() — the stream position, exposed so a test can assert it advances once per trigger whatever p is.
bool process_edge (bool trigger_edge)
 Decides one already-detected trigger edge.
bool process (SampleType trigger)
 Detects the edge from a trigger signal and decides it, so this block can sit directly on a clock output without a separate detector.

Static Public Member Functions

static constexpr int latency_samples ()

Static Public Attributes

static constexpr double kDefaultProbability = 0.5
 Pass probability.
static constexpr std::uint32_t kProbSeed = 0x1234567u
 [design parameter] default 0x1234567, range 0 .. 2^31 − 1.

Detailed Description

template<typename SampleType = float>
class pulp::signal::ProbGateT< SampleType >

Passes each incoming trigger with a stated probability, deterministically.

The draw is a seeded Xorshift32 (series law 2), so a probabilistic groove can be auditioned, bounced and reloaded and give the same performance every time. Changing the seed is how you roll again; the seed is a config value and never an automation lane.

A draw is consumed on every trigger regardless of p. p gates the result, never whether we draw. If a p of 1 skipped the draw, automating p during a take would shift the stream position and every later decision with it — the same pattern would render differently depending on the automation that preceded it, which is exactly the reproducibility law 2 exists to protect.

A transport reset edge clears the edge-detector latch but does not rewind the stream: a live reset jack that rewound randomness would make every reset sound identical.

USE. Generative drums — on a hi-hat clock for humanized density; automate p for a build-up that is still bit-reproducible. Trigger thinning — drop hits from a BurstGenT (kit) ratchet for un-mechanical rolls. Sometimes-accent — GateLogicT(and) of a probability gate with a downbeat clock.

RT contract: as the header. One generator call per trigger.

Constructor & Destructor Documentation

◆ ProbGateT()

template<typename SampleType = float>
pulp::signal::ProbGateT< SampleType >::ProbGateT ( )
inline

Member Function Documentation

◆ apply_reset_edge()

template<typename SampleType = float>
void pulp::signal::ProbGateT< SampleType >::apply_reset_edge ( )
inline

Verb 2: clears the edge-detector latch only. The RNG stream is untouched.

◆ draw_count()

template<typename SampleType = float>
std::uint32_t pulp::signal::ProbGateT< SampleType >::draw_count ( ) const
inline

Number of draws consumed since the last reset() — the stream position, exposed so a test can assert it advances once per trigger whatever p is.

◆ latency_samples()

template<typename SampleType = float>
constexpr int pulp::signal::ProbGateT< SampleType >::latency_samples ( )
inlinestaticconstexpr

◆ prepare()

template<typename SampleType = float>
void pulp::signal::ProbGateT< SampleType >::prepare ( double )
inline

◆ probability()

template<typename SampleType = float>
double pulp::signal::ProbGateT< SampleType >::probability ( ) const
inline

◆ process()

template<typename SampleType = float>
bool pulp::signal::ProbGateT< SampleType >::process ( SampleType trigger)
inline

Detects the edge from a trigger signal and decides it, so this block can sit directly on a clock output without a separate detector.

◆ process_edge()

template<typename SampleType = float>
bool pulp::signal::ProbGateT< SampleType >::process_edge ( bool trigger_edge)
inline

Decides one already-detected trigger edge.

◆ reset()

template<typename SampleType = float>
void pulp::signal::ProbGateT< SampleType >::reset ( )
inline

Verb 1: clears the latch and rewinds the stream to the seed.

◆ set_probability()

template<typename SampleType = float>
void pulp::signal::ProbGateT< SampleType >::set_probability ( double p)
inline

◆ set_seed()

template<typename SampleType = float>
void pulp::signal::ProbGateT< SampleType >::set_seed ( std::uint32_t seed)
inline

Member Data Documentation

◆ kDefaultProbability

template<typename SampleType = float>
double pulp::signal::ProbGateT< SampleType >::kDefaultProbability = 0.5
staticconstexpr

Pass probability.

[design parameter] default 0.5, range 0 .. 1.

◆ kProbSeed

template<typename SampleType = float>
std::uint32_t pulp::signal::ProbGateT< SampleType >::kProbSeed = 0x1234567u
staticconstexpr

[design parameter] default 0x1234567, range 0 .. 2^31 − 1.


The documentation for this class was generated from the following file: