How would you generate the sample of a drum, say "tom". Using the programming language and it's functions like addition, multiplication, sine, sqrt etc. I tried to generate the sine wave and then sharply cut the volume and add some white noise. This trick gave me something somewhat drumish, but far from perfect.
There are different approaches to generate artificial (I guess that's what you're aiming at here) drum sounds. The approach that you describe is certainly a good way to start - i.e. look at an existing sample that you're trying to approximate and find the properties that make up it's main characteristics. For example
- is it tonal (e.g. like a tom or bass drum) or noise-like (e.g. like a high-hat) or a mixture (e.g. like a snare)?
- what's the frequency/spectrum of the tonal part
- what's the bandwidth of the noise part
- what's the attack / decay behaviour
Knowing these important aspects of many percussive sounds, you can try to modify - e.g. - a sine wave by changing the frequency and amplitude over time, adding (filtered) noise and so on. Some experimenting will yield sounds similar to that of the classic TR-808. This machine may also be a nice source of inspiration on how to approach drum modelling using basic synthesis elements.
Another - somewhat more involved - approach is called physical modelling. This method starts from trying to emulate and - as the name says - physically model the elements that are involved in actually generating a sound. In the case of drum synthesis this comprises, for example:
- the drum head
- the stick that is used to hit the head
- the drum shell.
A thesis on exactly this topic can be found here.
Resources on how to actually program these models can for example be found in the communities of Pure Data, Csound or SuperCollider as these are programming environments that have been specifically designed for audio/music signal processing (for example, see here for a short tutorial on drum synthesis in Pure Data).
For some theoretical background, I have been recommended the musimathics books, but have not read them personally.