piano synthesis
Show older comments
Hello,
I am doing a project that asks the user for a note number and producing a piano sound with that pitch. I am trying to achieve this through additive synthesis (if there are simpler ways, let me know) and right now I have made a sound much like that of a kazoo with a fundamental plus 24 partials. Here is some of the code:
srate = 44100;
ff = 27.5*2^((noteNumber-1)/12);
t = (0:1/srate:2);
mag = [1, .7, .95, .75, .6, .65, .65, .5, .6, .5, .45, .5, .6, .5, .25, .5, ...
.3, .25, .3, .4 , .4, .3, .25, .2, .15];
for i = 1:25
y = y + mag(i)*sin(2*pi*ff*i*t);
end
*Note: The numbers in mag represent the amplitude coefficients which were selected somewhat arbitrarily and through analysis of a piano sound.
Ideally, I want to create something like one of these two samples.
How would I achieve these? I know I need to add the percussive hammer sound in the beginning and some inharmoncities. How can I make a sound like the ones shown above? Some help/code would be greatly appreciated. Thank you
Answers (0)
Categories
Find more on Piano sounds 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!