scamp_extensions.utilities package

Subpackage containing utility functions that do not fit into any of the other extension categories.

Modules:

scamp_extensions.utilities.math

Subpackage containing mathematical utility functions (many of which are imported from scamp.utilities.

scamp_extensions.utilities.sequences

Subpackage containing utility functions for manipulating lists/sequences (some of which are imported from scamp.utilities).

scamp_extensions.utilities.time_varying_parameter

This module defines the TimeVaryingParameter class, a convenience subclasses of Envelope that is aware of the clock and can be called to look up its value at the current beat or time.

Public-Facing API (result of import *):

gcd(x, y, /)

greatest common divisor of x and y

ceil_to_multiple(x, factor)

Returns the multiple of factor that is closest above x.

ceil_x_to_pow_of_y(x, y)

Returns the integer power of y that is closest above x.

floor_to_multiple(x, factor)

Returns the multiple of factor that is closest below x.

floor_x_to_pow_of_y(x, y)

Returns the integer power of y that is closest below x.

is_multiple(x, y)

Checks if x is a multiple of y.

is_prime(a)

Checks if a is a prime number.

is_x_pow_of_y(x, y)

Checks if x is an integer (including negative) power of y

make_flat_list(l[, indivisible])

Flattens a list, including ones containing multiple levels of nesting.

prime_factor(n)

Returns a list of the prime factors of n.

round_to_multiple(x, factor)

Returns the multiple of factor that is closest to x (above or below).

round_x_to_pow_of_y(x, y)

Returns the integer power of y that is closest to x (above or below).

sum_nested_list(l)

Sums up all of the values within a nested list.

lcm(a, b)

Return lowest common multiple.

remap(value_or_values, out_min, out_max[, …])

Rescales the given value or values so that they fall within the given output range.

rotate_sequence(s, n)

Rotates a sequence s such that it begins with element l[n] and wraps back around to l[n-1].

sequence_depth(seq)

Find the maximum _depth of any element in a nested sequence.

TimeVaryingParameter(levels, durations, …)

A simple wrapper around Envelope that is aware of the current time or beat in the current clock.