Ejemplo n.º 1
0
def Port(port):
    """
    Port(port)

    Change the event's port number.
    """
    return _Unit(_mididings.Port(_util.actual(port)))
Ejemplo n.º 2
0
def Key(note):
    """
    Key(note)

    Change note events to a fixed note number.
    """
    return _Unit(_mididings.Key(note))
Ejemplo n.º 3
0
def Channel(channel):
    """
    Channel(channel)

    Change the event's channel number.
    """
    return _Unit(_mididings.Channel(_util.actual(channel)))
Ejemplo n.º 4
0
def Key(note):
    """
    Key(note)

    Change note events to a fixed note number.
    """
    return _Unit(_mididings.Key(note))
Ejemplo n.º 5
0
def CtrlMap(ctrl_in, ctrl_out):
    """
    CtrlMap(ctrl_in, ctrl_out)

    Convert controller *ctrl_in* to *ctrl_out*, i.e. change the event's
    control change number.
    """
    return _Unit(_mididings.CtrlMap(ctrl_in, ctrl_out))
Ejemplo n.º 6
0
def Sanitize():
    """
    Sanitize()

    Make sure the event is a valid MIDI message.
    Events with invalid port (output), channel, controller, program or note
    number are discarded. Note velocity and controller values are confined to
    the range 0-127.
    """
    return _Unit(_mididings.Sanitize())
Ejemplo n.º 7
0
def SysEx(port, sysex):
    """
    SysEx(sysex)
    SysEx(port, sysex)

    Create a system exclusive event, replacing the incoming event.
    *sysex* can be a string (binary or ASCII) or a sequence of integers,
    and must include the leading ``F0`` and trailing ``F7`` bytes.
    """
    return _Unit(_mididings.SysExGenerator(
        _util.actual_ref(port),
        sysex,
    ))
Ejemplo n.º 8
0
def Ctrl(port, channel, ctrl, value):
    """
    Ctrl(ctrl, value)
    Ctrl(port, channel, ctrl, value)

    Create a control change event, replacing the incoming event.
    """
    return _Unit(_mididings.Generator(
        _constants.CTRL,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        ctrl,
        value
    ))
Ejemplo n.º 9
0
def NoteOff(port, channel, note, velocity=0):
    """
    NoteOff(note, velocity=0)
    NoteOff(port, channel, note, velocity=0)

    Create a note-off event, replacing the incoming event.
    """
    return _Unit(_mididings.Generator(
        _constants.NOTEOFF,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        note,
        velocity
    ))
Ejemplo n.º 10
0
def Program(port, channel, program):
    """
    Program(program)
    Program(port, channel, program)

    Create a program change event, replacing the incoming event.
    """
    return _Unit(_mididings.Generator(
        _constants.PROGRAM,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        0,
        _util.actual_ref(program)
    ))
Ejemplo n.º 11
0
def PolyAftertouch(port, channel, note, value):
    """
    PolyAftertouch(note, value)
    PolyAftertouch(port, channel, note, value)

    Create a polyphonic aftertouch event, replacing the incoming event.
    """
    return _Unit(_mididings.Generator(
        _constants.POLY_AFTERTOUCH,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        note,
        value
    ))
Ejemplo n.º 12
0
def Aftertouch(port, channel, value):
    """
    Aftertouch(value)
    Aftertouch(port, channel, value)

    Create an aftertouch event, replacing the incoming event.
    """
    return _Unit(_mididings.Generator(
        _constants.AFTERTOUCH,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        0,
        value
    ))
Ejemplo n.º 13
0
def Pitchbend(port, channel, value):
    """
    Pitchbend(value)
    Pitchbend(port, channel, value)

    Create a pitch-bend event, replacing the incoming event.
    """
    return _Unit(_mididings.Generator(
        _constants.PITCHBEND,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        0,
        value
    ))
Ejemplo n.º 14
0
def Generator(type, port=_constants.EVENT_PORT,
              channel=_constants.EVENT_CHANNEL, data1=0, data2=0):
    """
    Generator(type, port, channel, data1=0, data2=0)

    Generic generator to change the incoming event's type and data.
    System common and system realtime events can only be created this way.
    """
    return _Unit(_mididings.Generator(
        type,
        _util.actual_ref(port),
        _util.actual_ref(channel),
        data1,
        data2
    ))
Ejemplo n.º 15
0
def CtrlRange(ctrl, min, max, in_min=0, in_max=127):
    """
    CtrlRange(ctrl, min, max, in_min=0, in_max=127)

    Linearly map control change values for controller *ctrl* from the interval
    [*in_min*, *in_max*] to the interval [*min*, *max*].
    Any input value less than or equal to *in_min* results in an output value
    of *min*. Likewise, any value of *in_max* or greater results in an output
    value of *max*.
    """
    if in_min > in_max:
        # swap ranges so that in_min is less than in_max
        in_min, in_max = in_max, in_min
        min, max = max, min
    return _Unit(_mididings.CtrlRange(ctrl, min, max, in_min, in_max))
Ejemplo n.º 16
0
def Velocity(offset):
    return _Unit(_mididings.Velocity(
                    offset, _mididings.TransformMode.OFFSET))
Ejemplo n.º 17
0
def VelocitySlope(notes, curve):
    _check_velocity_slope(notes, curve)
    return _Unit(_mididings.VelocitySlope(
                    notes, curve, _mididings.TransformMode.CURVE))
Ejemplo n.º 18
0
def CtrlCurve(ctrl, curve):
    return _Unit(_mididings.CtrlCurve(
                        ctrl, curve, _mididings.TransformMode.CURVE))
Ejemplo n.º 19
0
def VelocitySlope(notes, gamma):
    _check_velocity_slope(notes, gamma)
    return _Unit(_mididings.VelocitySlope(
                    notes, gamma, _mididings.TransformMode.GAMMA))
Ejemplo n.º 20
0
def VelocitySlope(notes, fixed):
    _check_velocity_slope(notes, fixed)
    return _Unit(_mididings.VelocitySlope(
                    notes, fixed, _mididings.TransformMode.FIXED))
Ejemplo n.º 21
0
def VelocitySlope(notes, multiply):
    _check_velocity_slope(notes, multiply)
    return _Unit(_mididings.VelocitySlope(
                    notes, multiply, _mididings.TransformMode.MULTIPLY))
Ejemplo n.º 22
0
def VelocitySlope(notes, offset):
    _check_velocity_slope(notes, offset)
    return _Unit(_mididings.VelocitySlope(
                    notes, offset, _mididings.TransformMode.OFFSET))
Ejemplo n.º 23
0
def CtrlCurve(ctrl, multiply):
    return _Unit(_mididings.CtrlCurve(
                        ctrl, multiply, _mididings.TransformMode.MULTIPLY))
Ejemplo n.º 24
0
def CtrlCurve(ctrl, gamma):
    return _Unit(_mididings.CtrlCurve(
                        ctrl, gamma, _mididings.TransformMode.GAMMA))
Ejemplo n.º 25
0
def Velocity(multiply):
    return _Unit(_mididings.Velocity(
                    multiply, _mididings.TransformMode.MULTIPLY))
Ejemplo n.º 26
0
def CtrlCurve(ctrl, offset):
    return _Unit(_mididings.CtrlCurve(
                        ctrl, offset, _mididings.TransformMode.OFFSET))
Ejemplo n.º 27
0
def Velocity(fixed):
    return _Unit(_mididings.Velocity(
                    fixed, _mididings.TransformMode.FIXED))
Ejemplo n.º 28
0
def PitchbendRange(min, max, in_min=-8192, in_max=8191):
    return _Unit(_mididings.PitchbendRange(min, max, in_min, in_max))
Ejemplo n.º 29
0
def Velocity(gamma):
    return _Unit(_mididings.Velocity(
                    gamma, _mididings.TransformMode.GAMMA))
Ejemplo n.º 30
0
def Transpose(offset):
    return _Unit(_mididings.Transpose(offset))
Ejemplo n.º 31
0
def Velocity(curve):
    return _Unit(_mididings.Velocity(
                    curve, _mididings.TransformMode.CURVE))