sc3.base.play module

Global play shortcut mostly for events and lambdas.

play(obj=None, *args, **kwargs)

Convenience function to play events and lambdas.

If called without any argument it will play the default event with the default parameters.

If called only with keyword arguments create an event with those keys and plays it.

If obj defines the method play just calls it with *args and **kwargs.

If obj is a dict, it creates an event and plays it adding kwargs if any. Only keyword arguments are allowed for this case.

If obj is a function, it creates a temp SynthDef and makes a Synth from it. The function should return the expression to be played or have it’s own output. This is mostly intended for simple lambda functions but can be used as a decorator.

All versions return the return value of the played object.