If you have a sample of a piano, say a 10000 samples of a 440 Hz A4 sampled at 48kHz and you want to play an octave above that, 880 Hz A5 using a 48kHz D/A converter you would have to «compress» the original waveform to 5000 samples. A means to do that is downsampling such that you keep and shift the low frequency content, but remove the high frequency content (to avoid aliasing).
If you want to do any processing on the waveform (say, an amplitude envelope), you might want to work at a higher intermediate resolution as any discontinuities (of derivative) of the envelope could itself cause aliasing. Then you would downsample correspondingly before playback (or file rendering in your case).
I am shure that practical rompler and wavetable synthesis designs have deviced more elaborate solution that trades sound quality, cpu and memory usage and processing delay in clever ways.