def set_eq(self, eq_pts, *args, **kw): """Set the equalization :py:class:`splat.interpol.spline` used to alter the amplitude of each particle in function of its frequency to create an equalization. The minimum and maximum frequencies used when creating the :py:class:`splat.gen.ParticlePool` is derived from the boundaries of the equalization spline.""" self._eq = interpol.spline(eq_pts, *args, **kw) self._min_f_log = _splat.lin2dB(self._eq.start) self._max_f_log = _splat.lin2dB(self._eq.end)
def curve(self, freq, p_freq, q): """This method implements the stastistical distribution used to pick the frequency for each :py:class:`splat.gen.Particle` object. It returns a frequency ``freq`` in linear scale altered around the target frequency ``p_freq`` with the parameter ``q``. The default implementation produces something a little bit like a normal distribution but is not a standard function.""" f_log = _splat.lin2dB(freq) s = _splat.lin2dB(p_freq) f_curve = s - 0.5 * ((2 * s) - (2 * f_log)) * math.exp(-( (s - f_log) * (s - f_log)) / _splat.dB2lin(q)) return _splat.dB2lin(f_curve)
def curve(self, freq, p_freq, q): """This method implements the stastistical distribution used to pick the frequency for each :py:class:`splat.gen.Particle` object. It returns a frequency ``freq`` in linear scale altered around the target frequency ``p_freq`` with the parameter ``q``. The default implementation produces something a little bit like a normal distribution but is not a standard function.""" f_log = _splat.lin2dB(freq) s = _splat.lin2dB(p_freq) f_curve = s - 0.5 * ((2 * s) - (2 * f_log)) * math.exp( -((s - f_log) * (s - f_log)) / _splat.dB2lin(q)) return _splat.dB2lin(f_curve)
def __init__(self, subgen, min_f=20.0, max_f=20000.0, *args, **kw): """The ``subgen`` object is a :py:class:`splat.gen.Generator` which is called once for each :py:class:`splat.gen.Particle` object used to produce the final sound. Due to the nature of the Particle objects, it should take a frequency argument.""" super(ParticleGenerator, self).__init__(subgen.frag, *args, **kw) self._subgen = subgen self._start = None self._end = None self._z = None self._eq = None self._q = None self._min_f_log = _splat.lin2dB(min_f) self._max_f_log = _splat.lin2dB(max_f) self._gain_fuzz = 0.0 self._relative_gain_fuzz = 0.0 self._pool = None self.progress_step = 10 self.do_show_progress = True