MCPcopy Create free account
hub / github.com/FastLED/FastLED / makeWhiteNoise

Function makeWhiteNoise

tests/fl/audio/test_helpers.h:323–334  ·  view source on GitHub ↗

Generate deterministic white noise using fl::fl_random with fixed seed

Source from the content-addressed store, hash-verified

321
322/// Generate deterministic white noise using fl::fl_random with fixed seed
323inline Sample makeWhiteNoise(u32 timestamp, float amplitude = 16000.0f,
324 int count = 512) {
325 fl::fl_random rng(12345); // Deterministic seed for reproducible tests
326 fl::vector<fl::i16> data;
327 data.reserve(count);
328 for (int i = 0; i < count; ++i) {
329 // Map u16 [0, 65535] to float [-1, 1]
330 float sample = (static_cast<float>(rng.random16()) / 32767.5f) - 1.0f;
331 data.push_back(static_cast<fl::i16>(amplitude * sample));
332 }
333 return Sample(data, timestamp);
334}
335
336/// Generate a linear frequency sweep (chirp) with phase accumulation
337/// Tests that a sweeping tone doesn't trigger vocal detection

Callers 4

vocal.hppFile · 0.85
equalizer.hppFile · 0.85
percussion.hppFile · 0.85

Calls 4

random16Method · 0.80
SampleClass · 0.50
reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected