Recently somebody asked me to provide some pink noise! I knew about white noise, but I did not know that noise can come in different colors.
I am providing a White Noise and Pink Noise Generator. So this is the perfect opportunity to play around with noise.
I am using my my AudioTools library with Jupyterlab, so first we need to define the include Path, then we can add AudioTools.h and AudioLibs/Jupyter.h which provides the functionality that we will use.
#pragma cling add_include_path("../src")
#include "AudioTools.h"
#include "AudioLibs/Jupyter.h"
To start we define the audio format that will be used throughout this document:
AudioBaseInfo cfg;
cfg.channels = 1;
cfg.sample_rate = 44100;
The generation of white noise is straight forward:
WhiteNoiseGenerator<int16_t> white(10000); // limit amplitude=volume
GeneratedSoundStream<int16_t> sound(white);// Stream generated from sine wave
sound.begin(cfg);
JupyterAudio audio("white.wav", sound, 600, 1024);
audio