music.Being

class music.Being[source]

Bases: object

A configurable sequence walker that renders notes.

Attributes are assigned from outside as well as within: the examples set perms, domain, curseq and the parameter sequences directly before calling walk or render. They are declared here so that surface is discoverable rather than implicit.

Examples

>>> being = Being()
>>> being.f_ = [220, 330, 440]
>>> being.d_ = [0.3, 0.3, 0.3]
>>> being.render(3, "being.wav")
__init__()[source]

Methods

__init__()

addSeq(sequence)

Add sequence to the Being.

freeze()

Freeze the Being.

howl()

Produce a howling sound.

mkArray()

Make array.

render(nn[, fn])

Render notes of the Being.

setPar([par])

Set parameter to be developed in walks and stays.

setPerms(perms)

Set permutations.

setSize(ss)

Set the size.

startBeing()

Start the Being.

stay(n[, method])

Stay for a certain number of notes.

walk(n[, method])

Walk a certain number of steps.

Attributes

dscale: Any
d_: Any
f_: Any
fv_: Any
nu_: Any
tab_: Any
A_: Any
D_: Any
S_: Any
R_: Any
total_notes: int
grid: Any
fgrid: Any
pointer: int
fpointer: int
seqsize: int
domain: Any
curseq: str
perms: Any
resources: dict
walk(n, method='straight')[source]

Walk a certain number of steps.

Parameters:
nint

Number of steps, which is the number of notes appended to the current sequence.

methodstr

How to walk. 'straight' takes consecutive elements of the grid; 'low-high' interleaves; 'perm-walk' permutes each successive window of seqsize elements by the next of perms.

Returns:
None

The steps are appended to the sequence named by curseq.

Raises:
ValueError

If method is not one of the three above.

IndexError

If 'straight' walks past the end of the grid. Walking is the method that moves the ground, and this one does not wrap: stay and 'perm-walk' both do, so this is the odd one of the three. It is left as it is because changing it would change what an existing caller gets; a walk that must not run out needs a grid long enough, or stay.

Notes

``’perm-walk’`` is a reconstruction. The original was lost with the code this class succeeded, and the method raised NotImplementedError rather than guess. What is here is the one reading the name and its neighbours support: it is stay() with method='perm' – the same cycle through perms, applied to a window of the grid – except that the window advances by seqsize for each permutation and the pointer ends where it walked to. Staying and walking differ by whether the ground moves; nothing else about the two methods differs either.

Unlike stay(), it never reads domain: a fixed domain is what staying means, so honouring it here would make the walk a stay. The window wraps around the end of the grid rather than running off it.

setPar(par='f')[source]

Set parameter to be developed in walks and stays.

Parameters:
parstr

Parameter to be set. Only ‘f’ is implemented, and it requires fgrid and fpointer to have been assigned by the caller, as perms, domain and curseq are.

Returns:
None
Raises:
ValueError

If par is anything but ‘f’. It used to be a silent no-op.

setSize(ss)[source]

Set the size.

Parameters:
ssint

Size to set.

Returns:
None
setPerms(perms)[source]

Set permutations.

Parameters:
permslist

List of permutations.

Returns:
None
stay(n, method='perm')[source]

Stay for a certain number of notes.

Parameters:
nint

Number of notes.

methodstr

Method of staying.

Returns:
array

Sequence of stayed notes.

addSeq(sequence)[source]

Add sequence to the Being.

Parameters:
sequencearray

Sequence to add.

Returns:
None
render(nn, fn=False)[source]

Render notes of the Being.

Parameters:
nnint

Number of notes to render.

fnstr or bool

File name to save the rendered notes.

Returns:
array or None: Rendered notes.
startBeing()[source]

Start the Being.

Parameters:
None
Returns:
None
mkArray()[source]

Make array.

Parameters:
None
Returns:
None
howl()[source]

Produce a howling sound.

Parameters:
None
Returns:
None
freeze()[source]

Freeze the Being.

Parameters:
None
Returns:
None