Skip to content

Commit

Permalink
Added whiteNoise
Browse files Browse the repository at this point in the history
  • Loading branch information
gecko0307 committed Feb 7, 2016
1 parent 42cdda7 commit d66ea02
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions dlib/audio/synth.d
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,22 @@ DEALINGS IN THE SOFTWARE.
module dlib.audio.synth;

import std.math;
import std.random;
import dlib.audio.sound;

/*
* Generate random audio signal
* snd - sound
* ch - channel to fill (beginning from 0)
*/
void whiteNoise(Sound snd, uint ch)
{
foreach(i; 0..snd.size)
{
snd[ch, i] = uniform(-1.0f, 1.0f);
}
}

/*
* Fill the sound with simple sinewave tone.
* snd - sound
Expand Down

0 comments on commit d66ea02

Please sign in to comment.