CS510: sound - Emergency Sound Detection
Author: Ovidiu Mura
Summary
The Emergency Sound Detection project creates the emergency signal using frequency modulation and store the it in a wav file; then the emergency sound is mixed with brown noise, white noise and pink noise. The brown, white and pink noise are generated by functions using math equations which describes these noises.
The mixed signals are plotted in time domain and frequency domain to show the resulted mix signal. I mixed the signals using addition, multiplication and average. I implemented covolution of the given signal with gaussian window and FFT convolution using Convolution Theorem. After the convolution, I implemented normalized and standard correlation to identify the emergency signal in the convoluted/mixed signal.
Finally, I implemented lowpass, highpass, and bandpass filters to remove frequencies from the mixed/convoluted signals using the Butter filter which returns the filtered coefficients based on the given arguments.
Full Description
- The emergency sound detection signal is generated based on the formula:
sin(2picft - betasin(2mfpi*t)), where cf is carrier frequency, mf is modulation frequency, beta is modulation index and t is time
- The brownian noise is generated using the following formula:
X(0)=X0, X(t+dt)=X(t)+N(0,(delta)2dt;t,t+dt), where N(a,b;t1,t2) is a normally distributed random variable with mean a and variance b; t1 and t2 is the time interval of N.
- The white noise is generated by producing random signal having equal intensity at different frequencies, giving a constant power spectral density.
random.uniform(-amplitudes, +amplitudes, time)
- The pink noise is generated using the pink filter
S(f) = 1/f^a, where 0 < a < 2, S is power spectral density, and f is the freqency.
-
All the generated signals are ploted in a chart with coordonates amplitudes per no of samples
-
The signals can be mixed by the following operations
- averaging the samples of each signal
- multiply the samples of each signal
- add the samples of each signal
-
Calculate the correlation factor of two signals to identify if the signals has any relation with each other using the formula below
- normalized correlation: norm_corr(x, y) = sum(x[n]*y[n])/sqrt(sum(x^2)*sum(y^2)), where 0 <= n <= n-1
- standard correlation: corr(x,y) = Sum (x[n]*y[n]), where 0 <= n <= n-1
-
The correlation results are printed on the screen and the mixed signals can also be projected using the command line i.e. '-is_emergency_signal_in_mix plot_brown'
-
The signals can be convoluted using the Convolution Theorem, for example: emergency signal with the noise signal
- Running the correlation of the convoluted signals show that the convolution destroy any relation between the two signals producing a negative result
-
Only the emergency signal is convoluted with the Gaussian window creating very close, smoothed copy of the original signal
-
DFT is calculated for Emergency signal, brown noise signal, white noise signal, pink noise signal and ploted in frequency domain
-
I implemented goertzel, low pass, high pass, and band pass filters to filter the signals for a given parameter and plot the filtered signals
Future Work
There are enhacements that can be done in future work.
- mix the emergency sound with other types of noise such as natural noise (taffic, rain, etc.)
- write the project in Rust programming language to get better performance for processing wav files with longer time samples
- plot the singals for some diagrams in time x-coordonate, currently it is plotted in amps per number of samples for some of the diagrams
- save the ploted diagrams in images, for a better user experience; currently the user must close the plot pop-up window to be able to continue
- run the band pass filter on the mixed signal to remove the frequencies different than frequencies of emergency signal
Command Line Usage
The project runs using command line parameters. You can execute the following command to print the usage of all command line arguments:
python main.py
or run the following command line with the -h and --h arguments to print more info of the usage
python main.py -h
Example of command line commands for main project functionality is shown below:
python main.py --create all
python main.py --avg_mix_plot brown
python main.py --avg_mix_plot plot_brown
python main.py --is_emergency_signal_in_mix brown
python main.py --convolve esound
python main.py --freq_domain esound
python main.py --filter filters
License
Emergency-Sound-Detection is licensed under the Apache License 2.0. The license details and conditions can be found in the LICENSE file of root directory