Ok, let's start from the basics. Audio is usually recorded (sampled - converted from a continuous analogue signal to a digital record) and stored as a series of numbers representing the momentary voltage of the signal at regular intervals.
Sampling rate is the rate at which we check and record the momentary value of the analogue signal. Common sampling rates are 44.1kHz, 48kHz, 96kHz and 192kHz.
Bit depth is the bit resolution of each sample. A very low voltage would be represented as a very low (binary) number and a very large voltage as a number close to the maximum possible. Common values are 16 bit and 24 bit but also floating point.
This data is recorded as a .wav file. These files have a header describing the form of the following data, including number of channels since a .wav file can be mono or stereo.
Now, the difference between a flute and a piano note lays in a different domain altogether. What I described above (sampling) is a digital representation of a signal in the time domain. But the difference between sounds can be in any or both, the time and the frequency domain.
Timbre or harmonic content of a sound is the amount of each frequency present in that sound. It is what allows us to distinguish different sounds.
To get from the time to the frequency domain, you need to perform an FFT (fast Fourier transform) on your data. This will give you the spectrogram of the sound which contains the information you need.
Interpreting a spectrogram to distinguish/recognize sounds can be quite a challenge and I guess it would be done statistically with some degree of error. To give you a starting point in what you're looking for, a guitar is a stringed instrument and strings have harmonic series with amplitudes 1/n*(nf) where 'n' is the number of the harmonic (multiple of its fundamental frequency) and 'f' is the fundamental frequency. A trumpet is a piped instrument, closed at one end and its harmonic series in the form of 1/(2n-1)[(2n-1)f].
So if we had both playing a middle 'A' (440Hz), the guitar would have harmonics (peaks on the spectrograph) at 440, 880, 1320, 1760 etc, while the trumpet would have them at 440, 1320, 2200, 3080 etc.
That was an example using two sounds with an obvious difference in the frequency domain. Next, lets compare two sounds that are very similar in the frequency domain but have a difference in the time domain - a guitar and a piano, both stringed instruments.
They both have strings so their harmonic series are the same, but one is a plucked instrument (guitar) while the other is struck (piano - has hammers striking the strings). Striking gives a faster attack (how fast the sound reaches its maximum level) than plucking does. So by measuring the time it takes a sound to reach its maximum level, we can differentiate a guitar from a piano.
Please feel free to ask if something from the above confuses you and I will edit my answer to clarify. I understand this might be too much information for one answer.