Rogan;

This is interesting.  I have some code that does pretty cool graining
/ glitching on samples (that I have yet to post on the forum) that I'm
currently using linear ramps for.

Cool!
 
 What would be the optimal shape for
the grain?

Well, that's a good question... it's a question like what is the best instrument or the most beautiful animal. In other words; it depends on taste and application. A envelope shape (or grain "window" if you like) that's perfect for me may be completely unsuitable for you. I do think that if we only have one the simplicity of the linear ramp is nice but more can be said on the topic.
 
 Sine wave attack (sqare-root)?

That would be a nice one, yes. Nothing could be "the best" but something like that would be a decent bet as a starting point, I think.
 
 And what are the effects
on the spectrum?

Well, what we have is a wave-form (the section of the buffer being played back) and a envelope over it which is actually another wave-form that gets multiplied with the first. For longer grains (or loops or recordings) this is no huge issue but as grains become shorter the envelope may approach a rate where it's wave-form comes close to the audible range in frequency. If we then consider that  a multiplication of two wave-forms really comes down to a ring modulator we'll see that the spectral content of the envelope will start generating side-bands for the audio.

This is not a bug, in fact it's a feature of granular (or pulselet, or....) synthesis and it gives us interesting options in sound-design. However, to make the most of those options we need to be able to talk about the curve of the ramps as the curve of the ramps will translate to harmonics of the "envelope wave-form" which will in turn end up in the sound. Hope fully we'll be able to find a way to talk about this to LiSa that doesn't make LiSa any more complicated then she needs to be; simple tools are nice.

I hope that served as a introduction. If you'd like to know a lot more about this topic I think the best thing to do is to considder getting the book "Microsound" by Roads. That book goes into considerable depth in the various properties of granular systems, how they interact and how they influence the final result.

Yours,
Kas.