Notein

Notein(poly=10, scale=0, first=0, last=127, mul=1, add=0)

Generates Midi note messages.

From a Midi device, takes the notes in the range defined with `first` and `last` parameters, and outputs up to `poly` noteon - noteoff streams in the `scale` format (Midi, hertz or transpo).

Parent class : PyoObject

Parameters:

    poly : int, optional
        Number of streams of polyphony generated. Defaults to 10.
    scale : int, optional
        Pitch output format. 0 = Midi, 1 = Hertz, 2 = transpo. 
        In the transpo mode, the central key (the key where there 
        is no transposition) is (`first` + `last`) / 2.
    first : int, optional
        Lowest Midi value. Defaults to 0.
    last : int, optional
        Highest Midi value. Defaults to 127.

Methods:

    get(identifier, all) : Return the first sample of the current 
        buffer as a float.

Notes:

    Pitch and velocity are two separated set of streams. 
    The user should call :
    
    Notein['pitch'] to retrieve pitch streams.
    Notein['velocity'] to retrieve velocity streams.    

    Velocity is automatically scaled between 0 and 1.
    
    The out() method is bypassed. Notein's signal can not be sent 
    to audio outs.

Examples:

    >>> s = Server().boot()
    >>> s.start()
    >>> notes = Notein(poly=10, scale=1, mul=.5)
    >>> p = Port(notes['velocity'], .001, .5)
    >>> b = Sine(freq=notes['pitch'], mul=p).out()
    >>> c = Sine(freq=notes['pitch'] * 0.997, mul=p).out()
    >>> d = Sine(freq=notes['pitch'] * 1.005, mul=p).out()

Methods details:

    Notein.get(identifier="pitch", all=False):

        Return the first sample of the current buffer as a float.
        
        Can be used to convert audio stream to usable Python data.
        
        "pitch" or "velocity" must be given to `identifier` to specify
        which stream to get value from.
        
        Parameters:

            identifier : string {"pitch", "velocity"}
                Address string parameter identifying audio stream.
                Defaults to "pitch".
            all : boolean, optional
                If True, the first value of each object's stream
                will be returned as a list. Otherwise, only the value
                of the first object's stream will be returned as a float.
                Defaults to False.