Playing back an audio file at an arbitrary rate with upsampling and downsampling
Some solutions that are ordered by complexity, simplest first.


The simplest solution is the one you have already implemented- pick the nearest value.
The next simplest is linear interpolation.  You use the two nearest values and use a weighted average based on how far the point is from each.  For instance, if the point you want is .3 samples past $x_1$ and .7 samples before $x_2$, the value would be $y = x_1*.7 + x_2*.3$.  This is still pretty simple and should have much better sound performance than your current solution.
The next simplest is quadratic interpolation, or, more generally, polynomial interpolation.  Polynomial interpolation is also sometimes referred to as spline interpolation.
The most complicated solution is Lanczos resampling.  This is where you use a windowed sinc filter to low-pass filter the data.  You pick the particular set of taps to use from the filter based on the particular delay (i.e. at what point you are between the samples).