├── README.md ├── .DS_Store ├── Chapter 1 ├── .DS_Store ├── .idea │ ├── libraries │ │ └── R_User_Library.xml │ ├── misc.xml │ ├── modules.xml │ ├── 第一章.iml │ ├── workspace.xml │ └── workspace-NSConflict-lei-mac10.14.2.xml ├── .ipynb_checkpoints │ └── 第一章 HelloWorld-checkpoint.ipynb └── 第一章 HelloWorld.ipynb ├── Chapter 2 ├── .DS_Store ├── 离散时间信号 │ ├── .DS_Store │ └── 时域中的离散时间信号.pdf ├── 离散时间系统 │ ├── .DS_Store │ └── 离散时间系统时域.pdf ├── .ipynb_checkpoints │ └── 离散时间傅里叶变换及其逆变换-checkpoint.ipynb ├── .idea │ ├── misc.xml │ ├── modules.xml │ └── Chapter 2.iml └── basic_operations.ipynb ├── Chapter 3 ├── Vuvuzela.wav ├── .vscode │ └── settings.json ├── anti_vuvuzela.wav ├── .idea │ ├── libraries │ │ └── R_User_Library.xml │ ├── misc.xml │ ├── modules.xml │ ├── Chapter 3.iml │ └── workspace.xml ├── vuvuzela_denoising.m └── vuvuzela_denoising.m~ ├── .vscode └── settings.json ├── environment.yml ├── .idea ├── misc.xml ├── modules.xml └── dspcourse.iml └── 第一章 HelloWorld.ipynb /README.md: -------------------------------------------------------------------------------- 1 | # dspcourse 2 | dspcourse 3 | -------------------------------------------------------------------------------- /.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/.DS_Store -------------------------------------------------------------------------------- /Chapter 1/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 1/.DS_Store -------------------------------------------------------------------------------- /Chapter 2/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 2/.DS_Store -------------------------------------------------------------------------------- /Chapter 3/Vuvuzela.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 3/Vuvuzela.wav -------------------------------------------------------------------------------- /Chapter 3/.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "/Users/lyu/anaconda3/bin/python" 3 | } -------------------------------------------------------------------------------- /Chapter 2/离散时间信号/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 2/离散时间信号/.DS_Store -------------------------------------------------------------------------------- /Chapter 2/离散时间系统/.DS_Store: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 2/离散时间系统/.DS_Store -------------------------------------------------------------------------------- /Chapter 3/anti_vuvuzela.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 3/anti_vuvuzela.wav -------------------------------------------------------------------------------- /Chapter 2/离散时间系统/离散时间系统时域.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 2/离散时间系统/离散时间系统时域.pdf -------------------------------------------------------------------------------- /Chapter 2/离散时间信号/时域中的离散时间信号.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/yuleiwhu/dspcourse/HEAD/Chapter 2/离散时间信号/时域中的离散时间信号.pdf -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "python.pythonPath": "/Users/lyu/anaconda3/bin/python", 3 | "python.linting.pylintEnabled": true 4 | } -------------------------------------------------------------------------------- /environment.yml: -------------------------------------------------------------------------------- 1 | name: example-environment 2 | dependencies: 3 | - numpy 4 | - scipy 5 | - matplotlib 6 | - sounddevice 7 | 8 | -------------------------------------------------------------------------------- /Chapter 2/.ipynb_checkpoints/离散时间傅里叶变换及其逆变换-checkpoint.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [], 3 | "metadata": {}, 4 | "nbformat": 4, 5 | "nbformat_minor": 2 6 | } 7 | -------------------------------------------------------------------------------- /Chapter 1/.idea/libraries/R_User_Library.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Chapter 3/.idea/libraries/R_User_Library.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Chapter 1/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Chapter 2/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Chapter 3/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 2/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 3/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/dspcourse.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /Chapter 1/.idea/modules.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /Chapter 2/.idea/Chapter 2.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Chapter 3/.idea/Chapter 3.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 14 | -------------------------------------------------------------------------------- /Chapter 1/.idea/第一章.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | -------------------------------------------------------------------------------- /Chapter 3/vuvuzela_denoising.m: -------------------------------------------------------------------------------- 1 | %HELP vuvuzela_denoising 2 | % 3 | %Vuvuzela cancellation with spectral subtraction technique. Based on the spectrum of the 4 | %vuvuzela only sound, this denoising technique simply computes an 5 | %antenuation map in the time-frequency domain. Then, the audio signal is 6 | %obtained by computing the inverse STFT. See [1] or [2] for 7 | %more detail about the algorithm. 8 | % 9 | %References: 10 | % 11 | %[1] Steven F. Boll, "Suppression of Acoustic Noise in Speech Using Spectral 12 | %Subtraction", IEEE Transactions on Signal Processing, 27(2),pp 113-120, 13 | %1979 14 | % 15 | %[2] Y. Ephraim and D. Malah, ?Speech enhancement using a minimum mean square error 16 | % short-time spectral amplitude estimator,? IEEE. Transactions in Acoust., Speech, Signal 17 | % Process., vol. 32, no. 6, pp. 1109?1121, Dec. 1984. 18 | % 19 | %Note: The file: Vuvuzela.wav must be located in the folder of this script file. 20 | %One can note that this time-frequency based technique creates a "musical 21 | %noise". 22 | % 23 | %Programmed by V. Choqueuse (contact: vincent.choqueuse@gmail.com) 24 | 25 | clear;close all;clc; 26 | 27 | fprintf('--- Vuvuzela Cancelation Program ---\n\n'); 28 | 29 | %load vuvuzela sound example 30 | fprintf('-> Step 1/5: Load vuvuzela.wav:'); 31 | [y,Fe]=audioread('Vuvuzela.wav'); 32 | x=y(100000:end,1).'; %remove the beginning of the sample 33 | Nx=length(x); 34 | fprintf(' OK\n'); 35 | 36 | %algorithm parameters 37 | apriori_SNR=1; %select 0 for aposteriori SNR estimation and 1 for apriori (see [2]) 38 | alpha=0.05; %only used if apriori_SNR=1 39 | beta1=0.5; 40 | beta2=1; 41 | lambda=3; 42 | 43 | %STFT parameters 44 | NFFT=1024; 45 | window_length=round(0.031*Fe); 46 | window=hamming(window_length); 47 | window = window(:); 48 | overlap=floor(0.45*window_length); %number of windows samples without overlapping 49 | 50 | %Signal parameters 51 | t_min=0.4; %interval for learning the noise 52 | t_max=1.00; %spectrum (in second) 53 | 54 | %construct spectrogram 55 | [S,F,T] = spectrogram(x+i*eps,window,window_length-overlap,NFFT,Fe); %put a short imaginary part to obtain two-sided spectrogram 56 | imshow(abs(S)) 57 | [Nf,Nw]=size(S); 58 | 59 | %----------------------------% 60 | % noisy spectrum % 61 | % extraction % 62 | %----------------------------% 63 | fprintf('-> Step 2/5: Extract noise spectrum -'); 64 | t_index=find(T>t_min & T Step 3/5: Estimate SNR -'); 74 | absS=abs(S).^2; 75 | SNR_est=max((absS./vuvuzela_specgram)-1,0); % a posteriori SNR 76 | if apriori_SNR==1 77 | SNR_est=filter((1-alpha),[1 -alpha],SNR_est); %a priori SNR: see [2] 78 | end 79 | fprintf(' OK\n'); 80 | 81 | %---------------------------% 82 | % Compute attenuation map % 83 | %---------------------------% 84 | fprintf('-> Step 4/5: Compute TF attenuation map -'); 85 | an_lk=max((1-lambda*((1./(SNR_est+1)).^beta1)).^beta2,0); %an_l_k or anelka, sorry stupid french joke :) 86 | STFT=an_lk.*S; 87 | fprintf(' OK\n'); 88 | 89 | %--------------------------% 90 | % Compute Inverse STFT % 91 | %--------------------------% 92 | fprintf('-> Step 5/5: Compute Inverse STFT:'); 93 | ind=mod((1:window_length)-1,Nf)+1; 94 | output_signal=zeros((Nw-1)*overlap+window_length,1); 95 | 96 | for indice=1:Nw %Overlapp add technique 97 | left_index=((indice-1)*overlap) ; 98 | index=left_index+[1:window_length]; 99 | temp_ifft=real(ifft(STFT(:,indice),NFFT)); 100 | output_signal(index)= output_signal(index)+temp_ifft(ind).*window; 101 | end 102 | fprintf(' OK\n'); 103 | 104 | 105 | %----------------- Display Figure ------------------------------------ 106 | 107 | %show temporal signals 108 | figure 109 | subplot(2,1,1); 110 | t_index=find(T>t_min & T Step 1/5: Load vuvuzela.wav:'); 31 | [y,Fe]=audioread('Vuvuzela.wav'); 32 | x=y(100000:end,1).'; %remove the beginning of the sample 33 | Nx=length(x); 34 | fprintf(' OK\n'); 35 | 36 | %algorithm parameters 37 | apriori_SNR=1; %select 0 for aposteriori SNR estimation and 1 for apriori (see [2]) 38 | alpha=0.05; %only used if apriori_SNR=1 39 | beta1=0.5; 40 | beta2=1; 41 | lambda=3; 42 | 43 | %STFT parameters 44 | NFFT=1024; 45 | window_length=round(0.031*Fe); 46 | window=hamming(window_length); 47 | window = window(:); 48 | overlap=floor(0.45*window_length); %number of windows samples without overlapping 49 | 50 | %Signal parameters 51 | t_min=0.4; %interval for learning the noise 52 | t_max=1.00; %spectrum (in second) 53 | 54 | %construct spectrogram 55 | [S,F,T] = spectrogram(x+i*eps,window,window_length-overlap,NFFT,Fe); %put a short imaginary part to obtain two-sided spectrogram 56 | imshow(abs(S)) 57 | [Nf,Nw]=size(S); 58 | 59 | %----------------------------% 60 | % noisy spectrum % 61 | % extraction % 62 | %----------------------------% 63 | fprintf('-> Step 2/5: Extract noise spectrum -'); 64 | t_index=find(T>t_min & T Step 3/5: Estimate SNR -'); 74 | absS=abs(S).^2; 75 | SNR_est=max((absS./vuvuzela_specgram)-1,0); % a posteriori SNR 76 | if apriori_SNR==1 77 | SNR_est=filter((1-alpha),[1 -alpha],SNR_est); %a priori SNR: see [2] 78 | end 79 | fprintf(' OK\n'); 80 | 81 | %---------------------------% 82 | % Compute attenuation map % 83 | %---------------------------% 84 | fprintf('-> Step 4/5: Compute TF attenuation map -'); 85 | an_lk=max((1-lambda*((1./(SNR_est+1)).^beta1)).^beta2,0); %an_l_k or anelka, sorry stupid french joke :) 86 | STFT=an_lk.*S; 87 | fprintf(' OK\n'); 88 | 89 | %--------------------------% 90 | % Compute Inverse STFT % 91 | %--------------------------% 92 | fprintf('-> Step 5/5: Compute Inverse STFT:'); 93 | ind=mod((1:window_length)-1,Nf)+1; 94 | output_signal=zeros((Nw-1)*overlap+window_length,1); 95 | 96 | for indice=1:Nw %Overlapp add technique 97 | left_index=((indice-1)*overlap) ; 98 | index=left_index+[1:window_length]; 99 | temp_ifft=real(ifft(STFT(:,indice),NFFT)); 100 | output_signal(index)= output_signal(index)+temp_ifft(ind).*window; 101 | end 102 | fprintf(' OK\n'); 103 | 104 | 105 | %----------------- Display Figure ------------------------------------ 106 | 107 | %show temporal signals 108 | figure 109 | subplot(2,1,1); 110 | t_index=find(T>t_min & T 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 62 | 63 | 64 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 160 | 161 | 162 | 163 | 164 | 179 | 180 | 181 | 200 | 201 | 202 | 221 | 222 | 223 | 242 | 243 | 244 | 245 | 246 | 247 | 248 | 249 | 250 | 251 | 252 | 253 | 254 | 255 | 256 | 257 | 258 | 259 | 260 | 261 | 262 | 1558953716161 263 | 267 | 268 | 269 | 270 | 271 | 272 | 273 | 274 | 275 | 276 | 277 | 278 | 279 | 280 | 281 | 282 | 283 | 284 | 285 | 286 | 287 | 288 | 289 | 290 | 291 | 292 | 293 | 294 | 296 | 297 | 298 | 299 | 300 | 301 | 302 | 303 | 304 | 305 | 306 | 307 | 308 | 309 | 310 | 311 | 312 | 313 | 314 | 315 | 316 | 317 | 318 | 319 | 320 | 321 | 322 | 323 | 324 | 325 | 326 | 327 | 328 | 329 | 330 | 331 | -------------------------------------------------------------------------------- /Chapter 1/.idea/workspace-NSConflict-lei-mac10.14.2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | 110 | 111 | 112 | 113 | 114 | 120 | 121 | 122 | 130 | 131 | 132 | 137 | 138 | 139 | 140 | 141 | 142 | 143 | 144 | 145 | 146 | 147 | 148 | 149 | 150 | 151 | 152 | 153 | 154 | 155 |