Skip to content

nmrr/signal-processing-in-100-lines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

signal-processing-in-100-lines

A 100 lines example of signal processing written in C++

In this example, a noisy square wave signal is generated. This signal is passed into a low-pass filter to reduce noise. An automatic gain control (AGC) is used to prevent fluctuation of the amplitude and get a constant output signal. Then, a limiter limits output value of each sample to a fixed value to avoid impossible value during conversion to 16-bit (hard clipping)

Build the example :

g++ -Wall -pipe -Ofast main.cpp -o signalprocessing

Run the example :

./signalprocessing > out

Use audacity (or other audio software) and import output data as Raw Data using the following parameters :

  • Signed 16-bit PCM
  • Little-endian
  • 1 Channel (Mono)
  • Sample rate : 44100

Cutoff frequency can be adjusted by changing the value of the variable lowPassSamples : a lower value will rise cutoff frequency.

About

A 100 lines example of signal processing written in C++

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages