MCPcopy Create free account
hub / github.com/bspaans/python-mingus / __init__

Method __init__

mingus/containers/note.py:54–78  ·  view source on GitHub ↗

:param name: :param octave: :param dynamics: Deprecated. Use `velocity` and `channel` directly. :param int velocity: Integer (0-127) :param int channel: Integer (0-15)

(self, name="C", octave=4, dynamics=None, velocity=None, channel=None)

Source from the content-addressed store, hash-verified

52 velocity = _DEFAULT_VELOCITY
53
54 def __init__(self, name="C", octave=4, dynamics=None, velocity=None, channel=None):
55 """
56 :param name:
57 :param octave:
58 :param dynamics: Deprecated. Use `velocity` and `channel` directly.
59 :param int velocity: Integer (0-127)
60 :param int channel: Integer (0-15)
61 """
62 if dynamics is None:
63 dynamics = {}
64
65 if velocity is not None:
66 dynamics["velocity"] = velocity
67 if channel is not None:
68 dynamics["channel"] = channel
69
70 if isinstance(name, six.string_types):
71 self.set_note(name, octave, dynamics)
72 elif hasattr(name, "name"):
73 # Hardcopy Note object
74 self.set_note(name.name, name.octave, name.dynamics)
75 elif isinstance(name, int):
76 self.from_int(name)
77 else:
78 raise NoteFormatError("Don't know what to do with name object: %r" % name)
79
80 @property
81 def dynamics(self):

Callers

nothing calls this directly

Calls 3

set_noteMethod · 0.95
from_intMethod · 0.95
NoteFormatErrorClass · 0.90

Tested by

no test coverage detected