pub struct WhiteNoiseProcessor<SampleType> { /* private fields */ }
Expand description

White-noise generator, returns random numbers between -1 and 1 using rand::rngs::SmallRng.

Float type for samples is generic, requires implementations of [num::Float] and rand::distributions::uniform::SampleUniform

Example

Generating sample by sample see audio_processor_traits::SimpleAudioProcessor:

use audio_processor_traits::SimpleAudioProcessor;
use audio_processor_utility::noise::WhiteNoiseProcessor;

let mut  processor = WhiteNoiseProcessor::<f32>::default();
let noise1 = processor.s_process(0.0);
let noise2 = processor.s_process(0.0);
let noise3 = processor.s_process(0.0);

Generating buffer by buffer see audio_processor_traits::simple_processor::process_buffer:

use audio_processor_traits::simple_processor::process_buffer;
use audio_processor_traits::VecAudioBuffer;
use audio_processor_utility::noise::WhiteNoiseProcessor;

let mut buffer = VecAudioBuffer::empty_with(2, 1000, 0.0);
let mut  processor = WhiteNoiseProcessor::<f32>::default();
process_buffer(&mut processor, &mut buffer);

Using as a standalone processor see [audio_processor_standalone]:

use audio_processor_standalone::StandaloneAudioOnlyProcessor;
use audio_processor_traits::BufferProcessor;
use audio_processor_utility::noise::WhiteNoiseProcessor;

let processor = BufferProcessor(WhiteNoiseProcessor::<f32>::default());
let _standalone = StandaloneAudioOnlyProcessor::new(processor, Default::default());
// now call standalone_start

Trait Implementations

Returns the “default value” for a type. Read more
Process a single sample. If the input is mult-channel, will run for each channel by default. If the processor is multi-channel, implement s_process_frame instead. Read more
Prepare for playback based on current audio settings
Process a multi-channel frame. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.