Need help with filters and Karplus-Strong algorithm (guitar strings)

2 views (last 30 days)
Hello everybody! Firstly, I am having some trouble to understand the filters used in the code below...I have to play a music note as described below. Secondly, I need to play a sequence of music notes separately and later all together.
Any help will be apreciated.
fs=44100;
A=150;
F=linspace(1/fs, 1000, 2^12);
x=zeros(fs*10, 1);
delay=round(fs/A);
b=firls(42, [0 1/delay 2/delay 1], [0 0 1 1]);
a=[1 zeros(1, delay) -0.5 -0.5];
[H,W]=freqz(b, a, F, fs);
zi=rand(max(length(b), length(a))-1,1);
note=filter(b, a, x, zi);
note=note-mean(note);
note=note/max(abs(note));
hplayer=audioplayer(note, fs);
play(hplayer);
hplayer;

Answers (0)

Categories

Find more on Audio Processing Algorithm Design in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!