A music synthesizer makes sounds by using an electrical circuit as an oscillator to create and vary the frequency of sounds in order to produce different pitches. As long as the pitch is within the range of frequency that can be heard by a human ear, its known as a musical pitch (so a dog whistle wouldnt count) as a musical pitch. You can use a keyboard to vary these pitches at discrete intervals that correspond to the notes on the musical scale. If you put several oscillators together, you can combine several pitches to create a chord.
OK, weve got pitch down (at least in a very simple sense). How do you vary the tone of a particular pitch? That is done by playing a given pitch with waveforms of different shapes (common waveforms include sine, square, sawtooth, and triangle waveforms). Since the harmonic structure of these waveforms differ, our ears interpret them as different tones. The sound you will hear can also be modified by voltage-controlled amplifiers (VCA) and voltage-controlled filters (VCF).
Synthesizers are able to only mimic the sounds of non-synthetic instruments, but also to create sounds that absolutely cannot be played by anything but a music...