Granulator

Granulator(table, env, pitch=1, pos=0, dur=0.10, grains=8, basedur=0.10, mul=1, add=0)

Granular synthesis generator.

Parent class : PyoObject

Parameters:

    table : PyoTableObject
        Table containing the waveform samples.
    env : PyoTableObject
        Table containing the grain envelope.
    pitch : float or PyoObject, optional
        Overall pitch of the granulator. This value transpose the 
        pitch of all grains. Defaults to 1.
    pos : float or PyoObject, optional
        Pointer position, in samples, in the waveform table. Each 
        grain sampled the current value of this stream at the beginning 
        of its envelope and hold it until the end of the grain. 
        Defaults to 0.
    dur : float or PyoObject, optional
        Duration, in seconds, of the grain. Each grain sampled the 
        current value of this stream at the beginning of its envelope 
        and hold it until the end of the grain. Defaults to 0.1.
    grains : int, optional
        Number of grains. Defaults to 8.
    basedur : float, optional
        Base duration used to calculate the speed of the pointer to 
        read the grain at its original pitch. By changing the value of 
        the `dur` parameter, transposition per grain can be generated.
        Defaults to 0.1.

Methods:

    setTable(x) : Replace the `table` attribute.
    setEnv(x) : Replace the `env` attribute.
    setPitch(x) : Replace the `pitch` attribute.
    setPos(x) : Replace the `pos` attribute.
    setDur(x) : Replace the `dur` attribute.
    setGrains(x) : Replace the `grains` attribute.
    setBaseDur(x) : Replace the `basedur` attribute.

Attributes:

    table : PyoTableObject. The table where to write samples.
    env : PyoTableObject. Table containing the grain envelope.
    pitch : float or PyoObject. Overall pitch of the granulator.
    pos : float or PyoObject. Position of the pointer in the sound table.
    dur : float or PyoObject. Duration, in seconds, of the grain.
    grains : int. Number of grains.
    basedur : float. Duration to read the grain at its original pitch.

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> snd = SndTable(SNDS_PATH + "/transparent.aif")
    >>> env = HannTable()
    >>> pos = Phasor(snd.getRate()*.25, 0, snd.getSize())
    >>> dur = Noise(.001, .1)
    >>> g = Granulator(snd, env, [1, 1.001], pos, dur, 24, mul=.1).out()

Methods details:

    Granulator.setTable(x):

        Replace the `table` attribute.
        
        Parameters:

        x : PyoTableObject
            new `table` attribute.

    Granulator.setEnv(x):

        Replace the `env` attribute.
        
        Parameters:

        x : PyoTableObject
            new `env` attribute.

    Granulator.setPitch(x):

        Replace the `pitch` attribute.
        
        Parameters:

        x : float or PyoObject
            new `pitch` attribute.

    Granulator.setPos(x):

        Replace the `pos` attribute.
        
        Parameters:

        x : float or PyoObject
            new `pos` attribute.

    Granulator.setDur(x):

        Replace the `dur` attribute.
        
        Parameters:

        x : float or PyoObject
            new `dur` attribute.

    Granulator.setGrains(x):

        Replace the `grains` attribute.
        
        Parameters:

        x : int
            new `grains` attribute.

    Granulator.setBaseDur(x):

        Replace the `basedur` attribute.
        
        Parameters:

        x : float
            new `basedur` attribute.