Base procedures#
- class bmusic.proc.Procedure(**kwargs)#
Procedure base class.
This base class does not have features specific to music animation; consider using
MusicProc
instead.A procedure animates objects, with input parameters from the user. Procedures are generalized: For example, a hammer procedure can be applied to a drum mallet, a piano key, etc.
Extend from this class to create your animator. Subclasses inherit available parameters from the parent class.
This class uses the
bmusic.ProcMetaCls
metaclass to automatically generate property docs.For each property, type hint and/or define a default value in the class.
Then write the docstring in the class’s docstring, explained further in the docs.
If you don’t want automatic docs, set
_gen_docs = False
.
- Parameters:
None
- animate()#
Do all animation.
- init(**kwargs)#
This is called after parameters are set from
__init__
.Override this method to do custom initialization.
- class bmusic.proc.MusicProc(**kwargs)#
Bases:
Procedure
Procedure superclass with utilities for music animation.
Yes, this whole library is meant for music animation, but the base Procedure class is empty. This class has some stuff specific for music animation.
- Parameters:
midi
:bmusic.MessageList
object containing messages to animate.Type: MessageList
- class bmusic.proc.ForEachProc(**kwargs)#
Bases:
MusicProc
Base class meant for animating the same thing on each message. e.g. for each message, do hammer; light up; etc.
Intensity of message is interpolated from velocity, using given bounds.
- Parameters:
max_intensity
: Maximum peak intensity. Happens when velocity is 127.Type: float
Default: 1
min_intensity
: Minimum peak intensity. Happens when velocity is 0.Type: float
Default: 0
midi
(inherited)
- class bmusic.proc.ProcMetaCls(name, bases, attrs)#
Metaclass for procedures. Automatically generates property documentation.
Sets
cls._params
, type set.In your class’s docstring:
Write a parameters section at the end; this is denoted with the text
Parameters:
. See an existing class for an example.For each parameter, document it. Again, see an existing example.
Example (put this at the end of docstring):
Parameters: param1 This is a parameter. Multiline descriptions are allowed. Must be 4 spaces indent. param2 ...
- static get_params(bases, attrs) tuple[set[str], set[str]] #
Returns set of procedure parameters, extending from bases.