foxonix replied the topic: Audio is Playing Too Fast or Too Slow
This is all good stuff. These comments and suggestions will come in handy for other users down the road.
The operation you're seeing when you set the sample rate in the program is normal. The reason the playback rate seems to move in steps is because the compiler has to adjust the rate that you enter to the nearest value that the chip can use. So for example, if you try freq=19.1k and freq=19.2k you may get the same sample playback rate because the value internal to the chip is being adjusted to the same value.
As for audio quality, 20 kHz will give you better audio quality, but the trade off is that this takes up more space in the memory and you can't fit as much audio in your program. For many applications that don't require much audio that's probably OK.