What you want here is a digital filter - specifically a lowpass filter.
There are two types of simple digital filter, Finite Impulse Response and Infinite Impulse Response.
A FIR filter works by summing, with some weighting, the previous n samples of the audio, and using that to generate the output sample. It's called "Finite Impulse Response", because a single impulse in the input can only affect a finite number of output samples.
An IIR filter, in contrast, uses its own previous output in addition to the current sample. It's called "Infinite Impulse Response" because of this feedback property; a single impulse can affect all future samples.
Of the two, the IIR filter is the simplest to implement, and in its most basic form looks like this:
state(N) = state(N - 1) * weighting + sample(N)
output(N) = state(N)
That is, for each input sample, reduce the previous state value by some amount and add the input, then use that as the output. As such, it's basically a moving average filter.
For example, if you set 'weighting' to 0.95, then each output sample is influenced 95% by previous samples and 5% by the current sample, and the output value will shift slowly in response to changing inputs. It will also be scaled up by 20X (1/(1-weighting)), so you should renormalize it accordingly.
Here's how the first few steps would work with your input data:
- Start by setting
state = 20 * 0.27
.
- Output
state / 20 = 0.27
- Update
state = state * 0.95 + 0.43 = 26.08
- Output
state / 20 = 0.278
.
- Update
state = state * 0.95 + 0.48 = 5.76
- Output
state / 20 = 0.288
And so forth. If you need more output data points than input data points, repeat your input samples n times before feeding into the filter, or interleave input samples with n zero samples. Both are valid, though they have different impacts on the filtered output.
There is a lot of theory behind digital filter design; in practice for a simple implementation you can probably use this first-order filter, and adjust the weighting value to suit.