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

Function generateWhiteNoise

tests/profile/fft_cq_compare.cpp:45–52  ·  view source on GitHub ↗

Generate white noise (flat spectrum, equal energy per Hz)

Source from the content-addressed store, hash-verified

43
44// Generate white noise (flat spectrum, equal energy per Hz)
45static void generateWhiteNoise(fl::vector<fl::i16> &buf, int samples) {
46 buf.resize(samples);
47 fl_random rng(12345);
48 for (int i = 0; i < samples; i++) {
49 fl::i32 val = static_cast<fl::i32>(rng.random16()) - 32768;
50 buf[i] = static_cast<fl::i16>(val * 20000 / 32768);
51 }
52}
53
54// Generate pink noise (1/f spectrum, equal energy per octave)
55static void generatePinkNoise(fl::vector<fl::i16> &buf, int samples) {

Callers 1

runBenchmarkFunction · 0.85

Calls 2

random16Method · 0.80
resizeMethod · 0.45

Tested by

no test coverage detected