Sha256: a8558d77abd04f444a50b761bad6ee71049e81fdf6eb3598658113ac20e88234
Contents?: true
Size: 502 Bytes
Versions: 5
Compression:
Stored size: 502 Bytes
Contents
module Music module Performance module Interpolation # Linear interpolation # Given 2 sample points, interpolates a value anywhere between the two points. # # @param [Numeric] y0 First (left) y-value # @param [Numeric] y1 Second (right) y-value # @param [Numeric] x Percent distance (along the x-axis) between the two y-values def self.linear y0, y1, x raise ArgumentError, "x is not between 0.0 and 1.0" unless x.between?(0.0,1.0) return y0 + x * (y1 - y0) end end end end
Version data entries
5 entries across 5 versions & 1 rubygems