From 0b3049d054940c6e67484c3b6353ba0b537f43d3 Mon Sep 17 00:00:00 2001 From: nucular Date: Thu, 8 May 2014 16:21:26 +0200 Subject: [PATCH] Use interpolation instead of skipping a sample when generating for 22050 Hz --- sfxr.lua | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/sfxr.lua b/sfxr.lua index 3bb4a8c..6c516aa 100644 --- a/sfxr.lua +++ b/sfxr.lua @@ -386,7 +386,12 @@ function sfxr.Sound:generate(freq, bits) second_sample = not second_sample if freq == sfxr.FREQ_22050 and second_sample then -- hah! - return iter() + local nsample = iter() + if nsample then + return (ssample + nsample) / 2 + else + return nil + end end -- bit conversions