Skip to content

maximocrv/signal_processing

Repository files navigation

Signal Processing

Project for the MATH-458 course.

Requirements

It is necessary to have cmake to compile the code via the CMakeLists.txt file. jupyter-notebook is also necessary to visualize the plots of the outputted data from the codebase, as well as the libraries matplotlib, pandas, and numpy for generating the plots.

User Guide

In order to set up the project, first clone the repository and then run the following commands:

cd signal-processing
git submodule add https://github.com/adamstark/AudioFile.git
git submodule add https://github.com/google/googletest.git
git submodule init
mkdir build
cd build && cmake ..
make

The from the build directory run the file as follows:

./test_signal_processor
./run_signal_processor

You will be prompted to input a number of parameters. These include the window_average, which is an integer representing the moving average window that will be used for the time domain averaging, average_mode, which is a flag denoting the type of averaging that will be applied (the two options are "moving_average" and "exponential_average", but input them without the quotation marks). Lastly you will be asked to provide an input for n_bins, which is the integer representing the number of bins used to generate the histogram.

Second set of parameters for the Fourier filtered signal. First, a number (as a percentage) must be entered indicating which part of the signal we consider to be the main and which part to be noise. After that you should enter a filename and type of signal to be saved (label) (Signal, Frequency, CleanSignal, CleanFrequency ).

Once you have run this, you can run open the jupyter notebook plots.ipynb to visualize the results (note that there are already plots present which we have generated from our own test runs).

Repository Structure

The repository is structured as follows:

BaseSignalProcessor.hpp/cpp

Base class from which the TimeSignalProcessor class is derived. Contains custom constructor that sets the time signal to a member variable, as well as saving functionality which is used in the derived processor class. Contains method for saving and generating the histogram.

FourierTransform.hpp/cpp

Header and source file containing the FourierTransform class. It contains methods to perform the Fast Fourier Transform, which are subdivided into further smaller functions, the inverse Fourier Transform, and perform filtering in the Fourier domain.

TimeSignalProcessor.hpp/cpp

Header and source file containing the derived signal processor class which works with time domain signals. It contains methods to perform noise removal (either via the moving average or exponential moving average), and generate intensity histograms (the latter of which comes from the BaseSignalProcessor class).

run_file.cpp

Contains the implementation of the methods implemented in this class, as described above in the user guide.

tests.cpp

All the tests performed on the above classes containing into the tests/test.cpp:

  • Tests for FourierTransform class - fft_1, fft_2, inverse_fft_1, inverse_fft_2 and fft_filter
  • Tests for TimeSignalProcessor class - remove_noise and histogram_testing

Limitations & Future Improvements

Currently the code is not set up to deal with signals whose length is not a power of 2 (due to the specific implementation of the FFT). Furthermore it is only set up to work with mono channel signals.

External Libraries

AudioFile [1] - used for loading in wav files.

GoogleTest [2] - testing suite.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published