PlayArgs¶
- class maelzel.core.synthevent.PlayArgs(db=None, automations=None)[source]¶
Bases:
object
Playback customizations for an event or a set of events
Each
MObj
has aplayargs
attribute, which is an instance ofPlayArgs
and allows each object to set playback attributes like the instrument used, fade, pan position, etc. Each attribute set is added to thePlayArgs.args
dict.PlayArgs cascade similarly to css. If a note sets a specific attribute, like ‘instr’ (the instrument used), then this value is used since it is the most specific. If the note leaves that unset but the note is contained within a
Chain
and thisChain
sets the ‘instr’ key within its ownplayargs
, then this value is used. If that chain is contained within aScore
and the score itself has the ‘instr’ key set, then that value is used, etc. Fallback defaults are often defined in the configurationKeys¶
delay: when to schedule this synth. This time is added to the absolute offset of an object
- chan: the channel to output to. If the synth is multichannel this is the first of many
adjacent channels (TODO: implement channel mappings or similar strategies for spatialization)
gain: an overall gain of the synth
fade: a fade value or a tuple (fadein, fadeout), in seconds
instr: the instrument preset to use
pitchinterpol: interpolation mode for pitch (‘linear’, ‘cos’, ‘freqlinear’, ‘freqcos’)
fadeshape: shape of the fade curve (TODO)
args: any args passed to the instr preset (a dict {‘pname’: value}
- priority: the priority of this synth. Priorities start with 1, low priorities are evaluated
first. An instr with a higher priority is used to receive audio from an instr with a lower priority
- position: the horizontal placement inplace. 0=left, 1=right. For multichannel (> 2)
presets this value is interpreted freely by the instrument, which does its own spatialization
- sustain: if positive the last breakpoint is extended by this duration. This is used mainly for
sample based instruments (soundfont) to extend the playback. It can be used to implement one-shot sample playback
transpose: add an extra transposition to all breakpoints
glisstime: slide time to next event. This allows to add glissando lines for events even if their gliss attr is not set, or to generate legato lines
Attributes Summary
A list of Automations
A dictionary holding the arguments explicitely specified
Available keys for playback customization
Methods Summary
addAutomation
(param, breakpoints[, ...])- rtype:
None
clone
(**kws)Clone self with modifications
copy
()Returns a copy of self
fillWith
(other)Fill any unset value in self with the value in other inplace
get
(key[, default])Like dict.get()
items
()Like dict.items()
keys
()All possible keys for a PlayArgs instance
- rtype:
bool
makeDefault
(conf[, copy])Create a PlayArgs with defaults from a CoreConfig
makeSynthAutomations
(scorestruct, parentOffset)- rtype:
list
[SynthAutomation
]
setArgs
(**kws)Set one or multiple values for the parameters passed to a preset
update
(d)- rtype:
None
updated
(other[, automations])A copy of self overwritten by other
values
()The values corresponding to all possible keys
Attributes Documentation
- args¶
-
automations:
list
[Automation
] |None
¶ A list of Automations
-
db:
dict
[str
,Any
]¶ A dictionary holding the arguments explicitely specified
- playkeys = {'args', 'chan', 'delay', 'end', 'fade', 'fadeshape', 'gain', 'glisstime', 'instr', 'linkednext', 'pitchinterpol', 'position', 'priority', 'skip', 'sustain', 'transpose'}¶
Available keys for playback customization
Methods Documentation
- clone(**kws)[source]¶
Clone self with modifications
- Parameters:
**kws – one of the possible playkeys
- Return type:
- Returns:
the cloned PlayArgs
- fillWith(other)[source]¶
Fill any unset value in self with the value in other inplace
- Parameters:
other (
PlayArgs
) – another PlayArgs- Return type:
None
- keys()[source]¶
All possible keys for a PlayArgs instance
This is not the equivalent of the actual set keys (see
playargs.args.keys()
)- Return type:
set
[str
]
- static makeDefault(conf, copy=True)[source]¶
Create a PlayArgs with defaults from a CoreConfig
- Parameters:
conf (
CoreConfig
) – a CoreConfigcopy – if T
- Return type:
- Returns:
the created PlayArgs
- setArgs(**kws)[source]¶
Set one or multiple values for the parameters passed to a preset
- Parameters:
**kws (
float
|str
) – any keyword parameter passed to an instrument preset. They are not checked- Return type:
None