Generate deterministic white noise using fl::fl_random with fixed seed
| 321 | |
| 322 | /// Generate deterministic white noise using fl::fl_random with fixed seed |
| 323 | inline 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 |
no test coverage detected