I am in the midst of composing a piece in which I want the sound of artillery. What musical instrument can give this sound? (I am excluding actual artillery pieces and recordings of shots)
I don't think I'm allowed to do this on this SE. There is a piece by Tchaikovsky which is. Called Overtures 1812. In this incidental piece there is artillery written in the music. In performance there were a few which did use live artillery but most didn't. He ( Tchaikovsky ) himself never conducted the 1812 with live artillery. My advice to you is first look up for this overture in wikipedia I'll bring it down by copy paste "^ In the sections that contain cannon shots, actual cannon are sometimes replaced by recorded cannon or played on a piece of staging, usually with a large wooden mallet or sledgehammer. The bass drum and tam-tam are also regularly used in indoor performances." There is another. Place that discusses ways to duplicate artillery but I don't remember it right now.
You can use a "stick shot" on a snare drum. Hold one stick on the drum (tip on the drum head, shaft of the stick on the rim), then hit it really hard with the other stick. Or if you want machine gun-like fire, an open snare roll on an appropriate snare has been used historically in classical music for this sound. Or you can experiment with other drums or surfaces using this same technique.
I wouldn't recommend the timpani suggestion. It's unlikely you'll find a timpanist who would be willing to do that to their timpani. The roundness of the shells, quality of the head and shells are important to the intonation. So timpanists are sometimes hesitant to try anything extreme. But you can ask a timpanist what they would be willing to do to get a similar effect. A bass drum would probably be better, they're not fragile and percussionists are less scared to beat the crap out of them.
If you know a percussionist schedule a time to hang out and hit stuff! See what sounds like the kind of artillery you're looking for
There is a gunshot sound in the General MIDI percussion bank. So any sound bank or tone generator providing GM sounds will have something to offer.
You could notate it with a comment gunshot sfx, perhaps with an X-shaped note-head so you can indicate the rhythm. Or you could use the note which produces that sound in the GM percussion bank and explicitly require that (+ a note explaining that this note in this portion of the piece indicates the gunshot sound-effect). The choice here might depend upon whether you choose to give the responsibility for this sound to the keyboardist or the percussionist.
Or for showmanship, you could take a few paper cap-gun caps and smack 'em with a hammer. Choose carefully the surface upon which you do this. Something like an old metal wash tub might make some evil reverberations.