Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
def converted
low_pass!(buffer, 4000)
new_number_of_samples = ((8000.0 / 44100.0) * number_of_samples).ceil
period = 1 / buffer.sample_rate.to_f
new_period = 1 / target_sample_rate.to_f
new_number_of_samples.times do |m|
sum = 0
number_of_samples.times do |n|
blob = ((m * new_period) - (n * period)) / period
sum += buffer[n] * Math.sin(blob)/blob
end
downsampled[m] = sum
end
downsampled
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.