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

Function generateNoise

tests/fl/audio/test_helpers.hpp:72–82  ·  view source on GitHub ↗

Generate white noise

Source from the content-addressed store, hash-verified

70
71/// Generate white noise
72inline vector<i16> generateNoise(size count, i16 amplitude) {
73 vector<i16> samples;
74 samples.reserve(count);
75 for (size i = 0; i < count; ++i) {
76 // Simple pseudo-random noise (not cryptographically secure)
77 i32 noise = ((i * 1103515245 + 12345) >> 16) & 0x7FFF;
78 noise = (noise * amplitude) / 0x7FFF;
79 samples.push_back(static_cast<i16>(noise));
80 }
81 return samples;
82}
83
84} // namespace test
85} // namespace fl

Callers 1

FL_TEST_FILEFunction · 0.85

Calls 2

reserveMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected