I already wrote a small function for this:
func convert_stereo_to_mono(stream:AudioStreamSample):
var old_data = stream.get_data()
var new_data = range(old_data.size() / 2)
if stream.format == stream.FORMAT_16_BITS:
for i in new_data.size() / 2:
new_data[i * 2] = (old_data[i * 4] + old_data[i * 4 + 2]) / 2.0
new_data[i * 2+1] = (old_data[i * 4 + 1] + old_data[i * 4 + 3])/2.0
else:
for i in new_data.size():
new_data[i] = (old_data[i * 2] + old_data[i * 2 + 1]) / 2.0
stream.data = new_data
stream.stereo = false
It works great.