Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- clear all;
- close all;
- %Reading the file
- [y, fs] = audioread('gitara.wav');
- %Creating the vector according to which delay is varied
- a= 0.01;
- b= 0.4;
- low_n = round(a*fs);
- high_n = round(b*fs);
- delay_step = 2 /(1/fs);
- n = low_n;
- no_points = length(y(:,1));
- out_wav(:,1) = zeros(1,no_points);
- fwd_back = 0;
- ifs = 0;
- saved_signal = 1:high_n;
- k=1;
- for i=1:no_points
- if(fwd_back==0)
- ifs = ifs +1;
- delay(i) = ((high_n-low_n)/(2*fs))*ifs+low_n;
- end
- if(ifs == 2*fs)
- fwd_back = 1;
- ifs = ifs -1;
- end
- if(fwd_back==1)
- ifs = ifs -1;
- delay(i) = ((high_n-low_n)/(2*fs))*ifs+low_n;
- if(ifs == 0)
- fwd_back = 0;
- end
- end
- if (k<=high_n)
- saved_signal(k) = y(i);
- k = k+1;
- else
- k=1;
- end
- %n(i) = i-delay(i);
- %if uint32(n(i))>0
- if uint32(i>low_n*2)
- %out_wav(i) = y(i)+y(uint32(n(i)));
- signal_before = k - uint32(delay(i)) + 1;
- out_wav(i) = y(i)+ saved_signal(signal_before);
- else
- out_wav(i) = y(i);
- end
- end
- p = audioplayer(out_wav,fs);
- play(p);
- plot(out_wav);
- hold on;
- plot(y);
- pause;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement