SfPlayer

SfPlayer(path, speed=1, loop=False, offset=0, interp=2, mul=1, add=0)

Soundfile player.

Reads audio data from a file, and can alter its pitch using one of several available interpolation types, as well as convert the sample rate to match the Server sampling rate setting.

Parent class : PyoObject

Parameters:

    path : string
        Full path name of the sound to read.
    speed : float or PyoObject, optional
        Transpose the pitch of input sound by this factor. 1 is the 
        original pitch, lower values play sound slower, and higher 
        values play sound faster. Negative values results in playing 
        sound backward. At audio rate, fast changes between positive and
        negative values can result in strong DC components in the output 
        sound. Defaults to 1.
    loop : bool, optional
        If set to True, sound will play in loop. Defaults to False.
    offset : float, optional 
        Time in seconds of input sound to be skipped, assuming speed=1. 
        Defaults to 0.
    interp : int, optional
        Choice of the interpolation method. Defaults to 2.
            1 : no interpolation
            2 : linear
            3 : cosinus
            4 : cubic

Methods:

    setSound(path) : Replace the `sound` attribute.
    setSpeed(x) : Replace the `speed` attribute.
    setLoop(x) : Replace the `loop` attribute.
    setOffset(x) : Replace the `offset` attribute.
    setInterp(x) : Replace the `interp` attribute.

Attributes:

    sound : path, Full path of the sound.
    speed : float or PyoObject, Transposition factor.
    loop : bool, Looping mode.
    offset : float, Time, in seconds, of the first sample to read.
    interp : int {1, 2, 3, 4}, Interpolation method.

Notes:

    SfPlayer will sends a trigger signal at the end of the playback if 
    loop is off or any time it wraps around if loop is on. User can 
    retreive the trigger streams by calling obj['trig']:
    
    >>> sf = SfPlayer(SNDS_PATH + "/transparent.aif").out()
    >>> trig = TrigRand(sf['trig'])

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> snd = SNDS_PATH + "/transparent.aif"
    >>> sf = SfPlayer(snd, speed=.75, loop=True).out()

Methods details:

    SfPlayer.setSound(path):

        Sets a new sound to read.
        
        If the number of channels of the new sound doesn't match those 
        of the sound loaded at initialization time, erratic behaviors 
        can occur.
        
        Parameters:
        
        path : string
            Full path of the new sound.

    SfPlayer.setSpeed(x):

        Replace the `speed` attribute.
        
        Parameters:

        x : float or PyoObject
            new `speed` attribute.

    SfPlayer.setLoop(x):

        Replace the `loop` attribute.
        
        Parameters:

        x : bool {True, False}
            new `loop` attribute.

    SfPlayer.setOffset(x):

        Replace the `offset` attribute.
        
        Parameters:

        x : float
            new `offset` attribute.

    SfPlayer.setInterp(x):

        Replace the `interp` attribute.
        
        Parameters:

        x : int {1, 2, 3, 4}
            new `interp` attribute.