Git Product home page Git Product logo

noise_generator's Introduction

noise_generator

Noise generator developed in C, allow to play in backgroun White and Brown noise.

  • White Noise

    Whitenoise by definition contains all frequencies at a constant amplitude. To generate a white noise it is necessary to be able to generate a sequence a pseudo-random numbers in the range from [-1.0 .. 1.0) which are effectively distributed according to the standard uniform distribution.

    NOTE: First, and perhaps most important: be very, very suspicious of a system-supplied rand(). System-supplied rand()s are almost always linear congruential generators that will eventually repeat itself, with a period.

    That's why we need a better pseudo-random numbers generator. The white noise generator will use randq.c a better way to generate a random number. We will use the "Quick and Dirty" Generators, described in "Numerical Recipes in C" Second Edition at page 284, relies on 32-bit arithmetic and developed in randq.c through the following functions: srandqd, randqd_uint32 and randq_double;

  • Brown Noise

    White noise + digital low-pass filter

    Digital Low-pass filter:

    assume that samples of the input and output are taken at evenly spaced points in time separated by Delta_T time. Let the samples of v_in (the white noise) be represented by the sequence (x_1, x_2, ..., x_n), and let v_out (brown noise) be represented by the sequence (y_1, y_2, ..., y_n), which correspond to the same points in time.

     RC

     low-pass filter

    therefore, to obtain the brown noise sequence it is sufficient to apply this equation to the white noise sequence.

Stack

  • randq.c: a better pseudo-random numbers generator
  • Portaudio: audio I/O library

System requirements

Linux Ubuntu/Debian

# Requirements for white_noise_utest
sudo apt-get install libcmocka-dev 

# Requirements for portaudio
sudo apt-get install libasound-dev

# Downlod and install portaudo lib
git clone https://git.assembla.com/portaudio.git
cd portaudio
./configure && make
sudo make install

MacOS with Homebrew

brew install cmocka
brew install portaudio

BUILD

git clone https://github.com/alessandrocuda/noise_generator
cd noise_generator
make

Run

# Player
./white_noise           #run white_noise player
./brown_noise           #run brown_noise player

# unit_test
./white_noise_utest     #run unit test for white_noise

TODO

  • add Brown Noise
  • add Pink Noise
  • make a noises player with parameter to select the noise

Support

Reach out to me at one of the following places!

License

License

This library is free software; you can redistribute it and/or modify it under the terms of the MIT license.

noise_generator's People

Contributors

alessandrocuda avatar ickc avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.