- #1
rhcp13
- 1
- 0
Hello,
I'm not sure if this is the right place to write this thread, but I have a question about attempting to synthesize a piano in MATLAB. I am very new to MATLAB and DSP in general and my project is trying to create a piano sound using whatever means (FM synthesis, additive synthesis, etc... whatever is simplest). My program asks the user for a note number (1-88) and should produce the tone with a piano timbre. Right now, I have a signal that is build on the fundamental plus 24 partials with an ADSR envelope for the entire signal. Here is some of the sample code:
srate = 44100;
ff = 27.5*2^((noteNumber-1)/12);
t = (0:1/srate:2);
for i = 1:25
y = y + amp(i)*cos(2*pi*ff*i*t);
end
The sound I am producing is more like that of a kazoo. I know that I need to add the percussive strike of the hammer on the piano strings and some inharmonicities as well but do not know how to go about that? Any help/code would be greatly appreciated. Thank you very much
I'm not sure if this is the right place to write this thread, but I have a question about attempting to synthesize a piano in MATLAB. I am very new to MATLAB and DSP in general and my project is trying to create a piano sound using whatever means (FM synthesis, additive synthesis, etc... whatever is simplest). My program asks the user for a note number (1-88) and should produce the tone with a piano timbre. Right now, I have a signal that is build on the fundamental plus 24 partials with an ADSR envelope for the entire signal. Here is some of the sample code:
srate = 44100;
ff = 27.5*2^((noteNumber-1)/12);
t = (0:1/srate:2);
for i = 1:25
y = y + amp(i)*cos(2*pi*ff*i*t);
end
The sound I am producing is more like that of a kazoo. I know that I need to add the percussive strike of the hammer on the piano strings and some inharmonicities as well but do not know how to go about that? Any help/code would be greatly appreciated. Thank you very much