Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function [V] = flanger(inputPath, outputPath, maxSize, minSize, val, step)
- if(val > maxSize || val < minSize)
- disp('val has to be between minSize and maxSize!');
- val = randi(minSize, maxSize, 1);
- end
- [Y, FS] = audioread(inputPath);
- %rd = uint32(1);
- %wr = uint32(1);
- rd = 1;
- wr = val - 1;
- Z = Y;
- buf = Y(1:val) / 2;
- for i = 1:length(Y)
- if((mod(i, val) == 0 )|| (mod(i, val) > val))
- val = val + step;
- if (val < minSize)
- val = maxSize;
- end
- if (val > maxSize)
- val = minSize;
- end
- rd = 1;
- wr = val - 1;
- if ((i + val) < length(Y))
- buf = Y(i : i + val) / 2;
- end
- end
- Z(i) = Y(i) / 2;
- %disp('i == ');
- %disp(i);
- buf(wr) = Z(i);
- wr = mod((wr + 1), (val)) + 1;
- %disp('rd == ');
- %disp(rd);
- %disp('val == ');
- %disp(val);
- Z(i) = Z(i) + buf(rd);
- rd = mod((rd + 1), (val)) + 1;
- end
- audiowrite(outputPath, Z, FS);
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement