module SynthBlocks::Utils
Some simple utils
Public Instance Methods
bitreduce(input, bits=8)
click to toggle source
a simple bitreducer using rounding bits is the number of bits you want to reduce to
# File lib/synth_blocks/utils.rb, line 6 def bitreduce(input, bits=8) (input * bits.to_f).round.to_f / bits.to_f end
simple_waveshaper(input, a)
click to toggle source
waveshaper, source www.musicdsp.org/en/latest/Effects/41-waveshaper.html a can go from 1 to … oo the higher a the stronger is the distortion
# File lib/synth_blocks/utils.rb, line 13 def simple_waveshaper(input, a) input * (input.abs + a) / (input ** 2 + (a - 1) * input.abs + 1) end