Method: Music::Performance::PiecewiseFunction#add_points
- Defined in:
- lib/music-performance/util/piecewise_function.rb
#add_points(prev_point, point) ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'lib/music-performance/util/piecewise_function.rb', line 28 def add_points prev_point, point domain = prev_point[0]..point[0] func = lambda do |x| perc = (x - domain.min).to_f / (domain.max - domain.min) y = Interpolation.linear prev_point[1], point[1], perc return y end add_piece(domain, func) end |