Adding comments to the speech_analysis
This commit is contained in:
parent
aaec5b54fa
commit
4cfaf94544
|
|
@ -1,42 +1,56 @@
|
|||
%loading the signal library in octave
|
||||
pkg load signal
|
||||
clear all
|
||||
close all
|
||||
|
||||
%reading of the orignial signal in data
|
||||
[y,fs]=audioread('./data/modulator22.wav');
|
||||
|
||||
%calculation of the time from the sampling frequency
|
||||
t=0:1/fs:length(y)/fs-1/fs;
|
||||
|
||||
%showing the original signal
|
||||
##figure;
|
||||
##set(gcf, 'name','Signal of origin');
|
||||
##plot(t,y);
|
||||
##xlabel('time(s)');
|
||||
##ylabel('amplitude(n.u.');
|
||||
|
||||
%save a speed down version of the original signal
|
||||
audiowrite('./data/modulator22_speedown.wav', y , fs/2);
|
||||
|
||||
%save the speed down version's signal and sampling frequency and calculate it's new time duration
|
||||
[y_speedown,fs_speedown]=audioread('./data/modulator22_speedown.wav');
|
||||
t_speedown=0:1/fs_speedown:length(y_speedown)/fs_speedown-1/fs_speedown;
|
||||
|
||||
%showing the speed down version's signal
|
||||
##figure;
|
||||
##set(gcf, 'name','Speed down of the signal of origin');
|
||||
##plot(t_speedown,y_speedown);
|
||||
##xlabel('time(s)');
|
||||
##ylabel('amplitude(n.u.');
|
||||
|
||||
%Apply the DFT(flase) and FFT(true) to the speed down signal
|
||||
%frequencySpectrum(y_speedown, fs_speedown, false);
|
||||
%frequencySpectrum(y_speedown, fs_speedown, true);
|
||||
|
||||
%Illustrate the spectogram of the speed down version at 2 windows values (1 for a precise frequency read and 1 for a precise time domain)
|
||||
%spectrogram(y_speedown, fs_speedown, 5, 30);
|
||||
%spectrogram(y_speedown, fs_speedown, 5, 5);
|
||||
|
||||
%Lowering the sampling frequency using the downsample() function
|
||||
##y_downsampled = downsample(y, 2);
|
||||
##fs_downsample = fs/2;
|
||||
##audiowrite('./data/modulator22_downsample.wav', y_downsampled , fs_downsample);
|
||||
##t_downsample=0:1/fs_downsample:length(y_downsampled)/fs_downsample-1/fs_downsample;
|
||||
|
||||
%Lowering again the sampling frequency but with the decimate() function (applying a LP filter at the start )
|
||||
##y_decimated = decimate(y, 2);
|
||||
##fs_decimate = fs/2;
|
||||
##audiowrite('./data/modulator22_decimate.wav', y_decimated , fs_decimate);
|
||||
##t_decimate=0:1/fs_decimate:length(y_decimated)/fs_decimate-1/fs_decimate;
|
||||
##
|
||||
|
||||
%Comparing them both on the same graph to see the effect of the LP filter on the signal itself
|
||||
##figure;
|
||||
##set(gcf, 'name','Decimate vs Downsample');
|
||||
##title('Decimate vs Downsample');
|
||||
|
|
@ -46,11 +60,12 @@ t_speedown=0:1/fs_speedown:length(y_speedown)/fs_speedown-1/fs_speedown;
|
|||
##xlabel('time(s)');
|
||||
##ylabel('amplitude(n.u)');
|
||||
##legend('downsample()','decimate()',"location","southeastoutside");
|
||||
##
|
||||
|
||||
%Illustrating them with their frequencySpectrum to see the effect of the LP filter
|
||||
##frequencySpectrum(y_decimated, fs_decimate, true);
|
||||
##frequencySpectrum(y_downsampled, fs_downsample, true);
|
||||
|
||||
%%%FILTER IMPLEMENTATION %%%%
|
||||
%%%IIR and FIR LP FILTER IMPLEMENTATION %%%%
|
||||
%creating a low pass filter FIR
|
||||
N=30;
|
||||
fc=1000;
|
||||
|
|
|
|||
Loading…
Reference in New Issue