The system geometry (size and length of pipe, mass density, tension and length of string) determine the possible modes that could be excited. The "excitation" or initial condition determines which ones actually are, and how much energy goes into each. For a string, you can change the modal spectrum by plucking it at different positions from the end. Pluck at the center and and you excite the lowest mode plus odd harmonics. Pluck elsewhere and the spectrum (timbre) changes. Pull at two points simultaneously with different displacements (amplitudes) and you can get still different spectra.