The Struck Fixed-Fixed String
The generation of the piano sound begins when a player presses a complicated key and lever action, which throws a felt hammer against the string.[1] The piano hammer is made of wool felt, and the hammer acts as a nonlinear spring[2] The interaction between the nonlinear hammer and the string is a rather complicated physics problem, and there are many published papers tackling this problem, from experimental, theoretical, and computer modeling approaches.[3] The animations on this page are a crude approach to the struck string, to show how the Fourier Series and initial conditions can explain the basic physics.

Image source: https://imgur.com/NEpTu3a
The problem of the struck string is very similar to the problem of the Plucked String, in that there are two types of conditions which must be considered. The Boundary Conditions (ie, the values of displacement, velocity, and force at the each end of the string) determine the possible allowed mode shapes with which the string may vibrate at one of its natural frequencies. The Initial Conditions (the initial displacement and velocity of the entire string at time \(t=0\)) determine which of the possible allowed mode shapes actually participate in the ensuing motion, and with what amplitudes.
For a string which is fixed at both ends, the boundary conditions at each end require that the displacement of the string must always be zero. This results in mode shapes for which the transverse displacement at any point along the string depends on a sine function,
$$ \sin\Big(\frac{n\pi}{L}x\Big)\ , $$
where \(L\) is the length of the string, and \(n\) is an integer. The animation at right shows the first four allowed mode shapes for a fixed-fixed string. The number of "humps" (antinodes) corresponds to the value of \(n\).
After applying the boundary conditions, the complete expression for the transverse displacement of the string, as a function of time and postion along the string's length, is
$$ y(x,t) = \sum_{n=1}^N \big [A_n\cos(\omega_n t) + B_n\sin(\omega_n t)\big ] \sin\Big(\frac{n\pi}{L}x\Big) $$
where \(\omega_n\) is the natural frequency of the \(n\)th mode, and the coefficients \(A_n\) and \(B_n\) are determined from the initial displacement and velocity of the string, respectively.
The string has a linear density \(\rho_L\) [kg/m] and is stretched to a tension \(T\); transverse waves travel along the string with a speed \(c=\sqrt{T/\rho_L}\). The natural frequencies corresponding to the allowed mode shapes depend on the wave speed and the string length,
$$ \omega_n = 2\pi\, \frac{n c}{2 L} \ .$$
The natural frequencies will be higher if the string is shorter, or if the tension is higher, or if the density is lower. The natural (or allowed) frequencies are integer multiples of the fundamental (\(n=1\)) frequency.