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). 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.