FoxDot.lib.Repeat

class FoxDot.lib.Repeat.MethodCall(parent, method, n, cycle=None, args=(), kwargs={})[source]

Bases: object

Class to represent an object’s method call that, when called, schedules itself in the future

assign_beat()[source]
call_method()[source]

Calls the method. Prints to the console with error info.

count()[source]

Counts the number of times this method would have been called between clock start and now

get_next()[source]

Returns the beat that the next occurrence of this method call is due

isScheduled()[source]

Returns True if this is in the Tempo Clock

schedule()[source]

Schedules the method to be called in the clock

stop()[source]
update(n, cycle=None, args=(), kwargs={})[source]

Updates the values of the MethodCall. Re-adjusts the index if cycle has been changed

class FoxDot.lib.Repeat.MethodList(root)[source]

Bases: object

Class for holding information about the order of which methods have been called on Player attributes. root is the original Pattern.

add_method(method_name, args, kwargs)[source]
get_root_pattern()[source]
remove(method)[source]

Removes a method (should be a string) from the list of methods

set_root_pattern(new)[source]
update(method, args, kwargs)[source]

Updates the args and kwargs for a repeated method

class FoxDot.lib.Repeat.Repeatable[source]

Bases: object

after(n, cmd, *args, **kwargs)[source]

Schedule self.cmd(args, kwargs) in ‘n’ beats time ` # Stop the player looping after 16 beats p1 >> pads().after(16, "stop") `

after_update_methods = []
static convert_cycles(args, kwargs, occurence)[source]

Converts any values that are instances of Cycle to a var with the same duration as the frequency of the every call (occurrence)

every(occurence, cmd, *args, **kwargs)[source]

Every n beats, call a method (defined as a string) on the object and use the args and kwargs. To call the method every n-th beat of a timeframe, use the cycle keyword argument to specify that timeframe.

::

# Call the shuffle method every 4 beats

p1.every(4, ‘shuffle’)

# Call the stutter method on the 5th beat of every 8 beat cycle

p1.every(5, ‘stutter’, 4, cycle=8)

# If the method is not valid but is a valid Pattern method, that is called and reverted

p1.every(4, ‘palindrome’)

get_attr_and_method_name(cmd)[source]

Returns the attribute and method name from a string in the form “attr.method” would return “attr” and “method”. If attr is not present, it returns “degree” in place.

get_method_by_name(cmd)[source]

Returns the attribute name and method based on cmd which is a string. Should be in form “attr.method”.

is_pattern_method(method_name, attr='degree')[source]

Returns True if the method is a valid method of Pattern

is_player_method(method_name, attr='degree')[source]

Returns True if the method is a valid method of Player

method_synonyms = {'!': 'stutter', '->': 'rshift', '<-': 'lshift'}
never(cmd, ident=None)[source]

Stops calling cmd on repeat

stop_calling_all()[source]

Stops all repeated methods.

update_pattern_methods(attr)[source]

Update the ‘current’ version of a pattern based on its root and methods stored

update_pattern_root(attr)[source]

Update the base attribute pattern that methods are applied to